Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Cache-Control sets the rules for storing and reusing an HTTP response; ETag identifies a selected representation so a cache can check whether its stored copy is still current. They do different jobs and often work together: freshness policy can let a cache reuse a response without contacting the server, while an ETag can support validation when that response is stale.

Cache-Control and ETag answer different questions

Aspect Cache-Control ETag
Main role Directs cache behavior, including freshness and reuse. Provides an opaque validator for a selected representation.
Question it helps answer May this response be stored or reused under the applicable directives? Does the stored representation still match the current one?
Illustrative header Cache-Control: max-age=3600 ETag: "v7"
When it matters When caches decide how to store, age, and reuse a response. When a cache validates a stored representation, often after it becomes stale.

The example values are illustrative; HTTP standards do not prescribe them. An ETag is not a freshness duration, and HTTP does not require its value to be a timestamp or a particular kind of hash. RFC 9110 describes ETag as a validator that differentiates representations of the same resource, including variants selected through content negotiation (RFC 9110, section 8.8.3).

How freshness and validation work together

  1. A server sends a response with Cache-Control: max-age=60 and an ETag such as "v7". These values are an example, not a required configuration.
  2. While the response is fresh, a cache may reuse it under the applicable rules without contacting the origin server.
  3. After the response becomes stale, a cache may send a conditional request with If-None-Match: "v7" to ask whether its stored representation remains valid.
  4. If the representation is still current, the server can validate the stored copy; if it has changed, the server sends a new representation and validator.

This is the standards-defined relationship between freshness policy and validation, not a guarantee that every cache or server handles requests identically. RFC 9111 covers cache freshness and validation, while RFC 9110 defines entity-tag semantics (RFC 9111, HTTP Caching; RFC 9110, section 8.8.3).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Cache-Control directives mean

max-age sets a freshness lifetime

On a response, max-age=N gives the response a freshness lifetime of N seconds; once its age exceeds that value, it is stale. For a shared cache, s-maxage takes precedence when present. Otherwise, freshness calculation uses max-age if present, then Expires relative to Date; heuristic freshness may apply when there is no explicit expiration (RFC 9111).

must-revalidate restricts stale reuse

When a response becomes stale, must-revalidate means a cache must successfully validate it before reuse. If the cache cannot reach the origin, it must return an error rather than reuse that stale response (RFC 9111).

no-cache is not a no-storage instruction

no-cache means a stored response must be validated before it is reused; it does not, by itself, mean that the response cannot be stored (RFC 9111).

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Request and response directives are distinct

Cache-Control directives can appear in requests or responses, and their presence is unidirectional: a request directive does not imply that the same directive appears in the response. For example, request max-age expresses a client’s preference about the age of a response, while response max-age sets that response’s freshness lifetime (RFC 9111).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What an ETag does—and does not do

An ETag is an opaque validator for a selected representation. A client or cache can return it in If-None-Match so the server can evaluate whether that representation is still current. The tag itself does not say how long the response stays fresh or how a cache must behave; those decisions come from caching metadata and applicable rules. Its construction is not prescribed as a universal hash or timestamp format by HTTP (RFC 9110, section 8.8.3; RFC 9111).

Freshness does not force a browser display refresh

Freshness governs cache operation; it does not force a user agent to refresh its display or reload a resource. A browser’s display behavior and the cache’s permission to reuse a response are separate matters (RFC 9111).

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Stale-response extensions are not universal guarantees

RFC 5861 defines extensions such as stale-while-revalidate and stale-if-error, which describe circumstances in which stale content may be served while validation occurs or when an error arises. Whether a particular deployed cache supports these extensions depends on its implementation; the specification does not establish universal support (RFC 5861).

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.