What are the CDNs defaults?

Static files are cached by all regions for up to 31 days. You can override this duration by setting a Cache-Control header via the headers property in a vercel.json file.

Dynamic responses (from Serverless Functions) are not cached unless they contain a Cache-Control header with specific directives (e.g. s-maxage).

You can read more about file caching in the cache documentation.

How can I control the accepted CDN cache headers (and values)?

You can control how the CDN caches your responses by setting a Cache-Control header.

What if I am using a CDN like Akamai, Fastly, Cloudflare?

The transition is painless. All you have to do is configure DNS records to our DNS infrastructure.

How do I purge the CDN cache?

You can create a new deployment to invalidate the cache for your Preview and Production Deployments. Content will remain cached for preview URLs until it expires.

What are the limits of the CDN cache?

You can read more about our CDN caching limits in the caching documentation.

Can I run the CDN logic on my local development machine?

Using the vercel dev command via the Vercel CLI will allow you to run your applications with additional CDN logic.

Note: Using `vercel dev` is not necessary with Next.js applications — the CDN logic is already built-in with the `next dev` command.

How exactly does stale-while-revalidate work for the first and subsequent requests?

The first request is served synchronously. Subsequent requests are served from the cache and revalidated asynchronously if the cache is "stale".

You can read more about this in the stale-while-revalidate documentation.

What is the relation between the seconds on s-maxage and stale-while-revalidate?

s-maxage is the number of seconds a response is considered "fresh" by the CDN. After this period ends, the CDN will serve the "stale" response from the edge until the response is asynchronously revalidated with a "fresh" response to your Serverless Function.

Is my browser aware of stale-while-revalidate? Should I expect content-flash if yes?

We strip the stale-while-revalidate directive from your Cache-Control so browsers do not get it. This will allow you to deliver the latest content to your visitors right after creating a new deployment (as opposed to waiting for browser cache to expire).

What locations does the CDN cache in?

You can find the full list of our regions in the regions documentation.

Can I redirect users to a specific region?

Users who visit your deployments will automatically use the region that is geographically closest to them.

Will I get charged for CDN traffic in a DDoS event?

We do not charge you when automatically mitigating a DDoS event. We do, however, charge you for any requests that are successfully served prior to us automatically mitigating the event. When automated, this process typically takes under a minute.

For example, if a DDoS event lasts for three hours, you would only be billed for the one minute prior to the automatic mitigation starting.

Is there an image optimization service on your CDN?

Yes, Vercel supports Image Optimization integrated into frameworks like Next.js and Nuxt with zero configuration.

How do I use Cloudflare over your CDN (disable it)?

You will need to use Origin Control: Off along with other custom caching rules in Cloudflare. You will also need to set s-maxage to 0 with the headers property in a vercel.json file to disable any caching from our CDN.

When you create a new deployment, you will have to find a way to purge Cloudflare's cache.

Why do I see a 404 error when accessing my Deployment?

The path you are accessing was not found in the Build Outputs of your Deployment.

If you want to view your Build Outputs directly, you can turn on the Directory Listing.

You can also learn how to customize the 404 page.