An HTTP cache can reuse a stored response instead of downloading the full body again. The first question is whether that response is still fresh under its caching rules. If it is stale, the cache may ask the server whether the stored representation is still current. That second step is validation. It can save bandwidth even when the cache must contact the server.

Headers such as Cache-Control, ETag, and Last-Modified play different roles. A freshness lifetime tells a cache how long it may reuse a response without checking. A validator gives the cache a way to ask whether the response has changed. A 304 Not Modified reply means the cached body can be reused under the applicable rules; it is not an empty replacement page.

Decide Whether a Stored Response Is Fresh

A response with Cache-Control: max-age=600 has a freshness lifetime of 600 seconds. That is not a new 600-second period every time another cache receives the response. A cache accounts for the response's age, including time spent in upstream caches and in transit, when deciding how much freshness remains.

For example, if the calculated current age is 180 seconds, 420 seconds remain before a 600-second lifetime expires, assuming no stricter rule requires earlier validation. During the fresh period, a cache may reuse the response without contacting the origin if the other caching rules allow it. Once the response becomes stale, reuse requires successful validation or a rule that specifically allows stale content.

A stale response may still contain unchanged content. Conversely, the origin can change a resource while a cached response is still fresh, and the cache may continue serving the earlier version until its freshness lifetime ends. A longer lifetime reduces validation requests but can delay when visitors see updates. Select a caching policy according to the resource and its update pattern.

Send a Conditional Request

To validate a stored response that has an ETag, a cache sends that value in the If-None-Match header of a conditional GET request. The server compares that tag with the ETag of the representation selected for the request. If the stored response has a Last-Modified date, the cache can also send that date in If-Modified-Since. These conditions let the server avoid sending a body that the cache can already reuse.

For example, a cache that stored a page with ETag: "rev7" can later request it with If-None-Match: "rev7". If the tag still matches, the server returns 304 Not Modified with relevant updated metadata and no response body. The cache then updates the stored response as required and serves its existing body. If the tag no longer matches, the server normally returns a new 200 OK response with the current body and validators.

Read ETag and Last-Modified Carefully

An ETag is an identifier chosen by the server, not necessarily a version number or a content hash. Clients compare tag values without trying to interpret their contents. For the same resource, matching strong ETags indicate identical representation data. A weak ETag, such as W/"rev7", allows representations to be treated as equivalent for reuse even when their bytes differ.

If-None-Match uses weak comparison, so it can match either a strong or a weak tag with the same identifier. For example, "rev7" and W/"rev7" match under that comparison. A successful validation therefore does not always mean that every byte at the origin is identical to the cached body.

Last-Modified gives the server's modification time for the selected representation. HTTP dates have one-second resolution, so the date alone may not distinguish changes made within the same second. When a request contains both If-None-Match and If-Modified-Since, the server evaluates If-None-Match and ignores If-Modified-Since. The two conditions are not independent tests that must both pass.

Understand No-Cache and No-Store

Cache-Control: no-cache permits storage but requires successful validation before a stored response is reused. Despite its name, it does not mean that the body can never be stored. Cache-Control: no-store tells conforming caches not to store the response. These directives solve different problems, so substituting one for the other changes behavior.

Use Cache-Control: private when a response may be stored by a browser cache but must not be stored by a shared cache. For example, an account page can contain information that must not be reused for another visitor. Validation only checks whether a representation has changed; it does not grant another user access to that content.

Requests carrying Authorization have additional shared-cache restrictions. Some response directives explicitly permit shared caching, so a response to an authenticated request is not automatically excluded in every configuration. Check the response policy and any content delivery network (CDN) overrides before allowing personalized content into a shared cache.

Match the Stored Response to the Request

Vary identifies request fields that affect which representation the server selects. For example, Vary: Accept-Language tells a cache to account for the requested language, not just the URL. An English response must not be selected solely because its URL matches a request for a different language.

The same principle applies to compressed and uncompressed versions selected through Accept-Encoding. Validate the appropriate stored variant and associate the result with that variant. An ETag match does not remove the need to check the request fields named in Vary.

Trace a Validation Request

A browser cache, reverse proxy, and CDN can each have a different stored copy and policy. A response header viewed at the browser shows what arrived at that point, while an origin log shows whether the request reached the origin. Compare both before attributing a cache hit or miss to a particular layer. Keep examples free of credentials and personalized response bodies when sharing diagnostic evidence.

To diagnose an unexpected cache result, inspect the original response's freshness directive, validator, and Vary field. Then inspect the later conditional request and its response status at the same cache layer. A 200 OK response alone does not tell you whether the content changed: the request may have had no validator, or the server may have ignored the condition. Preserve the original headers while investigating; clearing the cache first removes the stored response you need to compare.