Rafal
Rafal

Reputation: 65

How can I implement Cache-Control: public in Vercel

I need to Cache Control my personal site and I don't know how or where should I tell the browser to cache the site.

I wanna use Cache-Control: public, max-age=31536000, immutable But don't know how as I'm using Next.js app hosted with Vercel.

Upvotes: 2

Views: 2034

Answers (1)

juliomalves
juliomalves

Reputation: 50308

When using Vercel you can configure the headers in your vercel.json file.

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

Upvotes: 4

Related Questions