Search code examples
google-app-enginecachingnuxt.jscache-controllighthouse

Serve static assets with an efficient cache policy - Nuxt.js + GAE


I get the following from Lighthouse:

enter image description here

How do I change the Cache TTL on a Nuxt.js SSR website? I found some answers but nothing about Nuxt.js...

IMPORTANT: Deployed in Google App Engine


Solution

  • The specific answer for GAE Apps, is the parameter handlers.expiration in app.yaml file:

    handlers:
      - url: /_nuxt
        static_dir: .nuxt/dist/client
        expiration: 4d 5h
        secure: always
    

    Or if you want to configure it globally, set the default_expiration parameter at the root level:

    default_expiration: 4d 5h
    

    Allows d (days), h (hours), m (minutes) and s (seconds). Here's the docs