A unique identifier for a resource to let web caches work more efficiently.
A ETag or "Entity Tag" is a special HTTP header that is given to a web resource such as an image, html file or script. If the resource changes, then the ETag must change as well. An ETag is essentially a checksum or hash of the file's contents. This allows servers and web caches to work more efficiently.
The Expires or Cache-Control headers are additional headers that should be used in combination with ETags. Here is how it works: A browser (or other caching layer) will use the
Cache-Control headers to determine when a resource has become stale and should be re-fetched. The browser will then send a request to the origin server and include the old ETag. The server will compare the ETags and if they match, then it will respond back to the browser with a "304 Not Modified" code instead of a "200 OK" code. The 304 response will include new caching headers, but will omit the body of the resource and thus save bandwidth. The browser will then reuse the old resource, and update its caching headers to indicate that it has been refreshed and is no longer stale.
If you are implementing ETags and you are using a multi-server configuration, then you need to be careful with implementing ETags because different servers can create different ETags for the same resource.
Ready to validate your website to check for this header and 100+ others important tests?