Static files are cached for a short time or not at all
NoticeQuick fix
Images, scripts, stylesheets or fonts of these pages may be kept by the browser for less than a week, or carry no cache lifetime.
Why it matters
A visitor who comes back, or opens a second page, downloads the same logo, stylesheet and scripts again. With a long lifetime the browser takes them from its cache and the page appears almost instantly.
How to fix it
- 1
Send "Cache-Control: max-age=31536000, immutable" for files whose name changes when their content does (most build tools add a hash to the name).
- 2
For files with a fixed name, a lifetime of a week to a month is a safe middle ground.
- How serious is it?
- Notice
- Opportunities and things to keep an eye on.
- How much work is it?
- Quick fix
- Usually minutes of work.
Further reading: web.dev: Serve static assets with an efficient cache policy
Does your site have this issue?
Check a page for free, or create an account to test your whole website.