Lighthouse · Checked on every page
Browser Cache PolicyWhat it checks and how to fix it
What it checks
Reads Lighthouse's cache policy audit, which lists the static resources (scripts, stylesheets, images, fonts) the page loads with a short or missing cache lifetime. Passes when the audit scores 100%, warns from 50%, and fails below 50%. It runs on the pages chosen for Lighthouse.
Why it matters
Resources without a long cache lifetime have to be downloaded again, or at least revalidated, every time a visitor comes back. Returning visitors are usually your most engaged ones, and making them re-fetch unchanged files slows every repeat visit and wastes bandwidth on both sides.
How to fix it
Give fingerprinted assets a one-year, immutable cache lifetime, and files with fixed names at least a day.
nginx
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
Apache
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType image/webp "access plus 1 month"
</IfModule>
Cloudflare: Caching → Configuration → Browser Cache TTL, or a Cache Rule for your asset paths with a long Browser TTL.
Rails
config.public_file_server.headers = { "Cache-Control" => "public, max-age=31536000, immutable" }
Third-party resources (analytics, widgets) are cached by their owners' rules; self-host them if their lifetime matters to you.