How to add a cache policy
timb-103 opened this issue · 1 comments
timb-103 commented
Environment
- Operating System:
Windows_NT
- Node Version:
v16.14.0
- Nuxt Version:
3.0.0
- Nitro Version:
1.0.0
- Package Manager:
npm@8.5.4
- Builder:
vite
- User Config:
app
,css
,modules
,googleFonts
,nitro
- Runtime Modules:
@nuxtjs/google-fonts@3.0.0-1
- Build Modules:
-
Reproduction
export default defineNuxtConfig({
css: ['@/assets/css/global.css'],
modules: ['@nuxtjs/google-fonts'],
googleFonts: {
families: {
Poppins: [300, 400, 500, 600, 700, 800, 900],
},
display: 'swap',
},
nitro: {
compressPublicAssets: true,
},
})
Describe the bug
Pagespeed insights is telling me to serve static assets with an efficient cache policy, but not sure how to do this in nuxt 3 or if it's possible?
I've added the compressPublicAssets flag to nitro and it does generate the .gz files in the output directory - but when visiting the website it's not loading them as seen in the image below:
Additional context
No response
Logs
No response
bot08 commented
export default defineNuxtConfig({
routeRules: {
'/_nuxt/**': { headers: { 'cache-control': 's-maxage=86400' } },
}
})
Something like this?