Web performance
A small guide to HTTP caching
How browser caches reduce repeated downloads without hiding updates.
Start with the response
HTTP response headers describe whether a representation may be stored and for how long it can remain fresh. Cache-Control and validators such as ETag let a browser reuse a resource or ask whether it has changed.
Give documents room to change
HTML documents often need shorter freshness windows than versioned assets. A browser can revalidate an older document and receive a small 304 response when the representation remains unchanged.
Version static assets
A filename that changes with its content can have a longer cache lifetime. This approach works well for stylesheets and images because the updated page points to a different URL after a new version is published.
Measure more than one visit
The first page load and a repeat visit exercise different paths. Compare transferred bytes, response timing and cache status. A fast repeat visit does not by itself prove that the initial load is fast.