Answer
An ETag (Entity Tag) is a response header containing a hash/version identifier for a resource. It enables conditional requests so the browser can revalidate cached content without re-downloading it.
Flow:
- Server sends
ETag: "abc123"with the resource. - On the next request the browser sends
If-None-Match: "abc123". - If unchanged, the server replies
304 Not Modified(empty body) → browser uses its cache. - If changed, server returns
200with the new body and a new ETag.
This saves bandwidth and is more precise than Last-Modified/If-Modified-Since (which is second-granularity only).
# Response
ETag: "686897696a7c876b7e"
# Subsequent request
If-None-Match: "686897696a7c876b7e"
# Response if unchanged
HTTP/1.1 304 Not Modified
Strong vs weak: W/"..." is a weak validator (semantically equivalent, not byte-identical).