Knowledge Base

Cache-Control

Cache-Control tells HTTP caches whether they may store a response, how long it stays fresh, and when they must check it again.

Storage and scope

  • no-store: do not store this response in HTTP caches.
  • private: a private browser cache may store it; shared caches must not.
  • public: explicitly permits shared caching, subject to the other caching rules.
  • no-cache: storage is allowed, but reuse requires successful validation.

private does not mean encrypted, and no-store does not erase copies already cached. These directives govern HTTP caching, not every kind of browser or application storage.

Freshness and reuse

max-age=600 sets a 10-minute freshness lifetime. s-maxage=60 overrides that lifetime for shared caches. The response's age counts toward the lifetime; receiving it from a CDN does not necessarily start a fresh timer.

must-revalidate prohibits reuse of stale content without successful validation. immutable avoids unnecessary revalidation while a response remains fresh and is suitable for content whose URL changes whenever its bytes change.

Choose by response type

# Public asset with a content-specific filename:
Cache-Control: public, max-age=31536000, immutable

# Public HTML that should be checked before reuse:
Cache-Control: no-cache

# Personalized content, browser storage allowed with validation:
Cache-Control: private, no-cache

# Sensitive response that should not enter HTTP caches:
Cache-Control: no-store

These are separate examples. Do not combine them into one policy. Set-Cookie alone does not universally prevent shared caching; set a deliberate policy for personalized responses.

ETag and Last-Modified support validation. Vary selects matching variants. Expires supplies a date-based lifetime, but applicable max-age or s-maxage takes precedence.

See caching by response type and stale content troubleshooting.

Sources

Copyright ©2026 MILAN INNOVATIONS LLC. All rights reserved.