The revalidation problem
When a cached response goes stale, the client must check whether the resource actually changed. Downloading the whole body just to discover it is identical wastes bandwidth. Conditional requests solve this by letting the server answer not modified when nothing changed.
ETags and validators
An ETag is an opaque token the server attaches to a response that identifies a specific version of a resource. On the next request the client sends it back in an If-None-Match header.
- If the current ETag matches, the server replies 304 Not Modified with no body.
- If it differs, the server returns the full new response and a fresh ETag.
- Last-Modified plus If-Modified-Since offers a weaker, timestamp based alternative.
ETags can be strong or weak. A strong validator means the bytes are byte for byte identical, while a weak validator only promises the representations are semantically equivalent. Weak tags are marked with a leading W slash prefix.
Key idea
An ETag identifies a resource version so a conditional request can return a tiny 304 Not Modified instead of resending unchanged data.