Browser Caching
HTTP caching headers and browser cache control.
Cache-Control Headers
No caching
Cache-Control: no-store, no-cache, must-revalidate
Cache for 1 year (static assets)
Cache-Control: public, max-age=31536000, immutable
Cache for 1 hour
Cache-Control: public, max-age=3600
Private cache (user-specific)
Cache-Control: private, max-age=3600
ETag & Last-Modified
ETag (content hash)
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
Client sends: If-None-Match
Last-Modified
Last-Modified: Wed, 21 Oct 2025 07:28:00 GMT
Client sends: If-Modified-Since
304 Not Modified
Server responds when content unchanged
Cache Busting
Query string versioning
app.css?v=1.2.3
app.js?v=2024010501
Hash in filename
app.a3f8b9c2.css
bundle.7d4e2a1f.js
Path versioning
/v2/app.css
/2024/bundle.js
Nginx Cache Headers
Static assets (1 year)
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 1y;
add_header Cache-Control public, immutable;
}
HTML (no cache)
location ~* \.(html)$ {
expires -1;
add_header Cache-Control no-store;
}