Caching · Response header
ETag
A version identifier for the resource — the backbone of conditional GETs.
What is ETag?
ETag is an opaque string uniquely identifying a specific version of a resource. Clients send it back in If-None-Match on later requests; if unchanged, the server returns 304 Not Modified with no body — a huge bandwidth win.
Typical usage
Set on cacheable responses. Most frameworks generate ETags automatically.
Examples
Strong ETag (byte-identical)
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"Weak ETag (semantically equivalent)
ETag: W/"0815"Common gotchas
Behind a load balancer, different instances must generate the same ETag for the same content, or caches will thrash. Base ETag on content hash, not memory address.
Specification
RFC 9110 §8.8.3
Related headers
If-None-Match
Send the resource only if its ETag has changed.
Cache-Control
Directives that control caching behavior.
Last-Modified
When the resource was last modified.
Expires
Legacy: an absolute HTTP date when the response becomes stale.
Age
How many seconds the response has been in a shared cache.
Vary
Which request headers cause different cached variants of the response.