Performance fix
How to Add Browser Cache Headers
Tell browsers to cache static assets so repeat visits load almost instantly.
- Difficulty
- Medium
- Impact
- Medium
- Time
- 15 min
Before
# No Cache-Control on /static/* assetsAfter
# Fingerprinted assets
Cache-Control: public, max-age=31536000, immutable
# HTML documents
Cache-Control: public, max-age=0, must-revalidateWithout cache headers, browsers download the same CSS, JavaScript and images on every visit. Give fingerprinted files a long Cache-Control lifetime with the immutable flag, and keep HTML short-lived or revalidated so new releases still reach visitors. Repeat visits then load almost entirely from the local cache.
Why it matters
Without cache headers, the browser re-downloads your CSS, JS and images on every visit. Long-lived caching for fingerprinted (hashed) assets makes repeat visits near-instant and cuts server load.
How to fix it
Cache hashed assets forever
Assets with a content hash in the filename can be cached for a year withimmutable: a new deploy gets a new filename.Keep HTML fresh
HTML should use a short max-age (orno-cache) so users get new content while assets stay cached.
The code
# No Cache-Control on /static/* assets# Fingerprinted assets
Cache-Control: public, max-age=31536000, immutable
# HTML documents
Cache-Control: public, max-age=0, must-revalidateOn your platform
WordPress
A caching plugin or your CDN sets far-future expiry on static files. Confirm in DevTools → Network that assets return cache-control: max-age.
Next.js
Next.js already serves /_next/static with immutable long cache; configure other static files in your proxy.
Sources
Check your site with our free tool
HTTP Header Checker
More fixes
Performance
How to Minify Your CSS
Strip comments and whitespace from stylesheets to cut their size by 30-50%.
Performance
How to Minify Your JavaScript
Compress JS by removing comments, whitespace and shortening names: often a 40-60% reduction.
Performance
How to Lazy-Load Off-Screen Images
Defer images below the fold so they don't compete with the initial render.
Fixed that one.
Now find the rest.
A free audit ranks every issue on your site by the score points it costs, and links each one straight to its guide.
Run a free audit