the Cache-Control header
When a shop wraps an item, it might add a note: best before next Tuesday, do not refrigerate, store demo only. Cache-Control is that note for an HTTP response. It is a single header line the server adds to its reply, carrying a comma-separated list of directives that tell every cache along the path exactly how it may store and reuse the response. It is the modern, precise replacement for the older Expires header, and the primary control knob of HTTP caching.
The most important directive is max-age, which gives a freshness lifetime in seconds: Cache-Control: max-age=3600 means a cache may reuse this response for an hour with no revalidation. Other common directives change who may cache and how: public (any cache, including shared proxies and CDNs, may store it), private (only the end user's own browser, never a shared cache — used for personalized pages), no-cache (you may store it, but you must revalidate with the origin before each reuse), and no-store (never write this to any cache at all, for truly sensitive data). Directives combine, so Cache-Control: public, max-age=31536000, immutable tells caches a file is shareable, reusable for a year, and guaranteed not to change.
Why it matters: this one header is where a site's caching strategy is actually expressed, and small choices have big effects. A typical pattern is long max-age plus a fingerprinted filename (like app.9f3c.js) for assets that never change, and no-cache or short max-age for HTML that must stay current. A frequent misconception: no-cache does not mean don't cache — it means cache, but always revalidate first; the directive that truly forbids storage is no-store. Getting this distinction wrong is a classic source of either stale pages or wasted bandwidth.
An avatar image carries Cache-Control: public, max-age=604800. A CDN and the browser may both store it and serve it for a week without contacting the origin. A logged-in dashboard instead carries Cache-Control: private, no-cache, so only that user's browser keeps it, and only after revalidating.
One header, many knobs: lifetime (max-age) plus who-may-cache (public/private) plus must-revalidate (no-cache).
Cache-Control is a request from the server, but caches and clients can still apply their own limits and a user can always force a refresh. It declares policy; it cannot guarantee a copy is never re-fetched.