通过高效的缓存策略提供静态资源 - Nuxt.js + GAE

lmf*_*eda 6 google-app-engine caching cache-control lighthouse nuxt.js

我从Lighthouse得到以下信息:

在此输入图像描述

如何更改Nuxt.js SSR 网站上的缓存 TTL?我找到了一些答案,但没有找到关于 Nuxt.js 的信息...

重要提示:部署在 Google App Engine 中

lmf*_*eda 3

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
Run Code Online (Sandbox Code Playgroud)

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

default_expiration: 4d 5h
Run Code Online (Sandbox Code Playgroud)

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