What is ETag (Entity Tag)?
An HTTP response header providing a unique cryptographic identifier for a specific version of a resource, used for efficient cache validation and preventing mid-air edit collisions.
Conditional HTTP Handshakes
When a web server generates a response, it computes a digest hash of the content and returns `ETag: "33a64df5"`. The client browser caches this identifier alongside the resource.
On subsequent requests, the browser sends `If-None-Match: "33a64df5"`. If the server verifies that the resource has not changed, it transmits a tiny `HTTP 304 Not Modified` header with zero body bytes, saving bandwidth and latency.
Key Advantages & Impact
- Eliminates redundant data transfers when resources have not changed
- Prevents 'Mid-Air Collisions' in REST APIs via If-Match pre-condition headers
- Works seamlessly across distributed CDNs and browser cache engines
Common Misconceptions vs Reality
Experience This Technology in DocSwift Tools
Frequently Asked Questions
What is the difference between strong and weak ETags?
A strong ETag guarantees byte-for-byte exact equality. A weak ETag (prefixed with W/ e.g. W/"123") indicates semantic equivalence (e.g. identical data with different whitespace).
Do ETags work with client-side SPAs?
Yes. Browsers handle ETag and 304 validation transparently in the background for fetch() and XMLHttpRequest calls.