Lighthouse kept warning me about inefficient cache lifetimes, even though I had already added caching for my static files.
The missing piece was Nuxt Image and its generated /_ipx URLs.
In this post, I’ll share the simple caching setup I use for Nuxt build files, public assets, and optimized images without risking stale content after deployment.
The basic rule is simple:
Cache files aggressively when changing the file also changes its URL. Be more careful when the same URL can serve different content later.
You have probably seen the same Lighthouse warning I have:
Use efficient cache lifetimes.
Browser caching for static files is usually straightforward. You add a Cache-Control header, choose a reasonable lifetime, and the browser avoids downloading the same files again on every visit.
However, in a Nuxt application, not every static-looking file should use the same caching policy.
Nuxt build files are automatically versioned. Files inside public/ usually are not. Nuxt
Discussion
Begin the discussion
Begin something meaningful by sharing your ideas.