Newnessimworks.com
Glossary · Web development

Cache-Control

The HTTP header that tells browsers and CDNs how long to cache a response and under what conditions to revalidate.

Definition

In long form.

Cache-Control directives include: max-age (seconds before stale), s-maxage (seconds for shared caches like CDNs), public / private (public allows shared caches, private = browser only), no-cache (must revalidate before serving), no-store (don't cache at all), stale-while-revalidate (serve stale while fetching fresh in background), immutable (asset never changes — common for hashed bundle filenames). Getting this right is often the highest-leverage performance tuning available.

In context

Hashed static assets (JS bundles, CSS) get `Cache-Control: public, max-age=31536000, immutable` — they never change because the hash changes when the content does. HTML pages get `s-maxage=60, stale-while-revalidate=86400` — fresh from CDN within a minute, stale-served for a day if the origin is slow.

Discovery first

Talk to us about your engagement.

Discovery calls are free. Scope, timelines, and pricing are quoted after we understand what you’re solving.