Overview

An ETag (Entity Tag) is a string (often a hash of the file content) that represents a specific version of a resource. It allows the browser to perform 'conditional requests' to see if a cached resource is still valid.

How it Works

  1. Initial Request: Server sends the resource with an ETag header.
  2. Subsequent Request: Browser sends the ETag back in the If-None-Match header.
  3. Validation: If the ETag matches, the server returns a 304 Not Modified status, and the browser uses the cached version. If it doesn't match, the server sends the new version.

Benefits

ETags prevent unnecessary data transfer when a resource hasn't changed, even if its max-age has expired.

Related Terms