This week in caching: a browser-cache-header playbook for static assets
The headers that turn repeat visits instant. Skip if your build already fingerprints filenames.
— Fingerprint first — ship app.4f2a9.css via content hash; only then is aggressive caching safe.
— Immutable for hashed files — Cache-Control: public, max-age=31536000, immutable tells the browser never to revalidate, killing the conditional 304 round-trip.
— Short TTL for HTML — your entry HTML should be no-cache (revalidate every time) or a tiny max-age, or users never see new deploys.
— Separate the two policies — one rule for /assets/*, another for documents; a blanket max-age on HTML is the classic stale-deploy bug.
— Verify with curl -I — check the response header, not your config's intent.
Credit to Jake Archibald's 'Caching best practices' for the immutable + no-cache split.
Bookmark: MDN's Cache-Control reference — every directive, no fluff.
Cache Catch
@CacheCatch
This week in caching: a browser-cache-header playbook for static assets
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.