Skip to the content
searchboar.

Crawling and indexing

Cache-Control: Meaning, examples and limitations

Cache-Control is an HTTP header containing instructions for storing and reusing responses in browsers and shared caches. Its directives describe freshness, validation and storage permissions; they do not decide whether a page belongs in a search index.

At a glance

  • no-cache requires validation before reuse; it does not mean never store.
  • no-store tells caches not to store the response.
  • Shared caching needs special care for personalized or private content.
On this page
Stored page copies and a clock illustrate cache freshness and reuse.
Cache-Control is an HTTP header containing instructions for storing and reusing responses in browsers and shared caches.

What do the common directives mean?

max-age gives a freshness lifetime. s-maxage addresses shared-cache freshness. private excludes shared-cache storage, while no-store instructs caches not to store the response. no-cache allows storage but requires successful validation before reuse. These differences are documented in the header reference.

The presence of a header is not proof of a cache hit. The cache's support, key and other response conditions also matter. Page caching describes actual stored-response reuse.

Example: an article and an account page

An identical public definition may be suitable for shared reuse. A page containing a signed-in customer's account information is a different case. Sending a broad public cache policy from a shared template can turn a performance change into a privacy defect.

Classify responses by their actual contents and scope. A public-looking path does not prove that the response is identical for every visitor, especially when cookies or authorization affect its output.

How are updates handled?

A long freshness lifetime can keep an old response reusable after the origin changes. Revalidation, invalidation or a versioned resource URL can address different parts of that problem. Fingerprinted static assets are often versioned so a new file has a new address.

A 304 response can confirm a stored representation during conditional validation. It is not the same as serving a fresh cache hit without contacting the origin.

How is this different from noindex?

Noindex concerns search-index inclusion; cache directives concern response reuse. A preview page can need both an indexing exclusion and no-store, for different reasons. Check the actual headers on the intended hostname and on error responses. A copied configuration example should never be applied globally without understanding which pages and caches it will affect.

Sources

  1. MDN: Cache-Control