如何在 Vercel 中实现 Cache-Control: public

How can I implement Cache-Control: public in Vercel

我需要缓存控制我的个人网站,但我不知道我应该如何或在何处告诉浏览器缓存该网站。

我想用 Cache-Control: public, max-age=31536000, immutable 但不知道如何使用 Next.js 由 Vercel 托管的应用程序。

使用 Vercel 时,您可以 configure the headersvercel.json 文件中。

{
    "headers": [
        {
            "source": "/(.*)",
            "headers" : [
                {
                    "key" : "Cache-Control",
                    "value" : "public, max-age=31536000, immutable"
                }
            ]
        }
    ]
}