Cache-Control Header
Pronunciation: KASH kun-TROHL HED-er
Also known as: HTTP Cache-Control Header
Definition
Cache-Control Header is an HTTP header that communicates caching directives for a request or response, including whether content may be stored, reused, revalidated, or shared. It controls cache behavior, while caching is the broader system practice of storing reusable results.
Overview
Meaning and scope
Cache-Control Header is an HTTP header that communicates caching directives for a request or response, including whether content may be stored, reused, revalidated, or shared. It controls cache behavior, while caching is the broader system practice of storing reusable results.
Mechanism and operation
The Cache-Control Header contract should define identifiers, validation, authorization, status semantics, errors, limits, and version behavior at the same boundary. A production implementation should mark sensitive payment and credential responses appropriately, define freshness explicitly, use validators when safe, account for shared caches, and test intermediaries rather than assuming browser-only behavior. Observability for Cache-Control Header should record operation, version, principal, request ID, latency, retry count, error code, and final state without exposing secrets. Useful measures include cache hit rate, stale-response incidents, revalidation rate, age of served data, private-response cache findings, and origin load. Testing Cache-Control Header should cover malformed input, denied access, rate limits, timeouts, duplicates, asynchronous completion, and version changes.
Practical payment example
An account balance endpoint marks its response non-cacheable so intermediary caches do not serve a previous customer’s financial data.
Operational checks
For Cache-Control Header, the application should preserve a correlation path from request construction through response, asynchronous completion, and final business state. A successful transport result from Cache-Control Header should not be interpreted beyond the exact API state documented by the provider. Changes to Cache-Control Header should be checked against older clients, stored payloads, enum growth, default behavior, and retry assumptions.
Distinctions and limits
The principal risks include private data stored by shared caches, stale payment status, authentication responses reused incorrectly, inconsistent directives, cache-key confusion, and performance loss from disabling useful caching globally.
Related reading
Related definitions: Caching, Accept Header.
Example
An account balance endpoint marks its response non-cacheable so intermediary caches do not serve a previous customer’s financial data.
Comparison
The principal risks include private data stored by shared caches, stale payment status, authentication responses reused incorrectly, inconsistent directives, cache-key confusion, and performance loss from disabling useful caching globally. A production implementation should mark sensitive payment and credential responses appropriately, define freshness explicitly, use validators when safe, account for shared caches, and test intermediaries rather than assuming browser-only behavior.
Key Takeaway
Mark sensitive payment and credential responses appropriately, define freshness explicitly, use validators when safe, account for shared caches, and test intermediaries rather than assuming browser-only behavior.
Sources
- HTTP Caching — IETF (2026-08-03)
- HTTP Semantics — IETF (2026-08-03)
- OWASP API Security Top 10 - 2023 — OWASP (2026-08-03)