By default, the CDN and browser will not cache, unless you set the following headers in your function as needed: Cache-Control,CDN-Cache-Control, and Vercel-CDN-Cache-Contol. You can set these headers to:
- Set the cache depending on location
- Set the same cache duration everywhere
- Set caching for Vercel's Cache
- Set caching for all CDNs
Setting the cache in functions takes priority over config files.
Copy link to headingSet caching depending on location
Vercel uses the following priority when you specify multiple cache control headers:
Vercel-CDN-Cache-ControlCDN-Cache-ControlCache-Control
Copy link to headingSame cache duration everywhere
This sets the same maximum cache duration for Vercel, CDNs, and the client:
Copy link to headingSet caching for Vercel's Cache
This sets the maximum cache duration for Vercel's Cache only.
Copy link to headingSet caching for all CDNs
This sets the cache duration on Vercel and also on other CDNs