Graph
Cache-Control

🛰️Cache-Control

NEW

An HTTP header that carries directives controlling caching behavior for requests and responses across intermediaries.

DESCRIPTION

Cache-Control is the primary HTTP header for instructing caches and browsers how to store and reuse responses. Directives include max-age, no-cache, no-store, private, public, and s-maxage. Correct configuration improves performance and reduces bandwidth, while misconfiguration can expose sensitive data or serve stale content. Modern HTTP caching is standardized in RFC 9111. Cache-Control supersedes older headers like Expires and Pragma.

ALTERNATIVE DEFINITIONS

MDN Web Docs

The Cache-Control HTTP header field holds directives (instructions) — in both requests and responses — that control caching in browsers and intermediaries.

Clarifies presence in both requests and responses and scope to intermediaries.

Source

IETF RFC 9111

The Cache-Control header field is used to specify caching directives for requests and responses.

Provides the formal standard definition for the header’s role.

Source

Hypertext Transfer Protocol ETag Vary Max-Age S-Maxage RFC 9111 Public Cache Private Cache

COMPETING TERMS

Expires Pragma

RELATIONS

KNOWLEDGE AREAS

Software Engineering Data Integration & Interoperability Data Security

TARGET AUDIENCE

Software Developer DevOps Engineer Security Architect Solution Architect

EXTERNAL SOURCES

TOP QUESTIONS

What is the Cache-Control header?

Cache-Control is an HTTP header containing directives that define how responses and requests are cached by browsers and intermediaries.

Category: Definition

How do Cache-Control directives impact performance?

Proper directives reduce repeated network requests and latency. They allow clients to reuse cached content within defined freshness windows.

Category: Relevancy

When should I use s-maxage vs max-age in Cache-Control?

Use s-maxage for shared caches like CDNs, overriding max-age for intermediaries. max-age applies to all caches but is often relevant to browsers.

Category: Requirements

What risks exist with misusing Cache-Control?

Misuse can leak sensitive data via public caches or serve stale content. Always set appropriate privacy and freshness directives.

Category: Risks

What’s the relation between Cache-Control and ETag?

Cache-Control sets caching policy; ETag enables conditional requests to validate freshness, reducing data transfer on updates.

Category: Example

Is Pragma still needed with Cache-Control?

Pragma is legacy. Modern clients rely on Cache-Control and headers defined by RFC 9111 for consistent behavior.

Category: Misunderstanding

How do I prevent caching completely?

Use Cache-Control: no-store and set other headers accordingly. Verify intermediaries honor the directive.

Category: Management

Can Cache-Control be set per request?

Yes. Clients can send Cache-Control directives in requests to influence caching behavior, such as no-cache or max-age=0.

Category: Overview

What’s currently a hot topic with Cache-Control?

Optimizing CDN caching with fine-grained directives and combining Cache-Control with immutable assets is widely discussed.

Category: Topic