A complete guide to HTTP caching
HTTP caching reduces latency, server load, and infrastructure costs by storing responses at multiple layers—browsers, CDNs, proxies, and application caches. The guide explains how Cache-Control directives (max-age, s-maxage, no-cache, no-store, stale-while-revalidate), validators (ETag, Last-Modified), and headers like Vary control freshness and revalidation. It covers common misconceptions (no-cache doesn't mean "don't cache"), freshness calculations, practical recipes for static assets, HTML, APIs, and authenticated content, plus browser behaviors like BFCache and speculation rules. A detailed Cloudflare section addresses CDN-specific defaults, edge cache TTLs, cache key normalization, and cache tags for event-driven purging.
