Ch. 20 · Networking

HTTP ETags and Conditional Requests

HTTP ETags and Conditional Requests. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readintermediateupdated Oct 3, 2026

ETags identify resource representations for conditional requests. Revalidation can avoid transferring an unchanged body; preconditions can also protect updates.

Before you start

You should understand clients, servers, IP addresses and ports. Follow a request through name resolution, connection establishment and application exchange. Distinguish protocol guarantees from deployment policy, and use observations from the relevant layer rather than guessing from one browser error message.

The practical goal is to reason through this situation: A client sends If-None-Match for a cached representation and handles an unchanged response. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Identify the representation

The ETag must correspond to the actual selected content.

Step 2: Revalidate cached reads

If-None-Match can avoid resending an unchanged body.

Step 3: Protect conditional writes

Server-enforced If-Match can reject stale edits.

Worked scenario

A client sends If-None-Match for a cached representation and handles an unchanged response.

Editors A and B load representation tag v1. A saves and the tag becomes v2. B’s write with If-Match:v1 fails its precondition instead of replacing A’s changes. Revalidation savings and update-conflict prevention use related conditional-request machinery but require different request conditions and response handling.

Common mistake

An ETag must correspond to the representation being validated.

Verify the behavior

Test unchanged read, changed read and stale conditional update.

Interview exercise

Prevent a lost update.

Answer and reasoning

Use an appropriate If-Match precondition with server enforcement and report conflicts rather than overwriting a changed resource.

Continue learning

Compare the scenario with the Networking interview questions and test your understanding with the Networking MCQs. For terminology and implementation details, consult the reference material.

More in Networking

read ✓Networking · mid

Networking: DNS Caching and TTL

Understand positive and negative caching, why changes are not instant, and how TTL trades propagation speed against query load.

~2 min readread →
read ✓Networking · easy

Networking: DNS Record Types

Read and choose DNS records: A and AAAA for addresses, CNAME for aliases, and MX and TXT for mail and verification.

~2 min readread →
read ✓Networking · mid

Networking: HTTP Redirects

Choose between 301, 302, 307 and 308, know which preserve the request method, and avoid caching and loop mistakes.

~2 min readread →
esc