Quiet Pages

The caching headers I actually use

12 November 2026

Every few months someone asks which caching headers a small site needs. The honest answer is: fewer than the articles suggest. I use three rules, and they cover almost every file I serve.

1. Files with a fingerprint: cache forever

Stylesheets, fonts and images get a short hash in the file name, like site.3f9a1c.css. When the file changes, the name changes, so the old copy can live in caches for as long as it likes:

Cache-Control: public, max-age=31536000, immutable

immutable tells the browser not to revalidate on reload. It saves a round trip per file on every page view.

2. HTML: always revalidate

Cache-Control: no-cache

This is the most misunderstood header on the web. no-cache does not mean “do not cache”. It means “keep a copy, but ask me before you use it”. With an ETag on the response, the browser sends If-None-Match and usually gets a tiny 304 Not Modified back. Pages stay fresh, and repeat visits stay cheap.

3. Private pages: never store

Cache-Control: no-store

Anything personal (account pages, receipts, admin screens) should never sit in a shared cache or on disk. This is the only place I use no-store.

What I stopped sending

  • Expires: max-age wins anyway.
  • Pragma: no-cache: a header from HTTP/1.0.
  • Last-Modified next to an ETag: one validator is enough.

If a CDN sits in front, I add s-maxage for the edge and keep the browser rules above. That is the whole list.

← All notes