Asking Only If Changed
A conditional request lets a client say send this only if it has changed. This revalidates a cached copy cheaply, avoiding a full transfer when nothing is new.
The Two Validators
A server attaches a validator to a response so the client can refer to that exact version later.
- An ETag is an opaque tag, often a hash, identifying a specific representation.
- A Last Modified date marks when the resource last changed.
The Conditional Headers
The client echoes a validator back on the next request.
- If None Match sends the stored ETag.
- If Modified Since sends the stored date.
If the resource is unchanged the server replies 304 Not Modified with no body, and the client reuses its cached copy. Otherwise it returns 200 with fresh content.
Strong vs Weak
ETags can be strong, meaning byte for byte identical, or weak, meaning semantically equivalent. Strong tags are required for partial range requests.
Key idea
Conditional requests use ETag or Last Modified validators with If None Match or If Modified Since, letting a server answer 304 Not Modified so an unchanged cached copy is reused without resending the body.