The Vercel Edge Network is active for all deployments and domains on your account and caches your content at the edge to serve data to your users as fast as possible.

The Vercel Edge Network is available for all of our pricing plans (including the Hobby plan) and can be activated for Serverless Functions (including SSR) by providing Cache-Control headers.

If Cache-Control headers are provided, responses will be cached in the region it’s requested from.

What is Cached?

In order for responses to be cached with the Cache-Control header by Vercel Edge Network for the requested path, the following criteria must be met:

  • Request must use GET or HEAD method.
  • Request must not contain the Range header.
  • Request must not contain the Authorization header.
  • Request must not contain a _vercel_no_cache=1 cookie.
  • Request must not contain a ?_vercel_no_cache=1 request parameter.
  • Response must use 200, 404, 301, or 308 status code.
  • Response must not exceed 10MB in content length.
  • Response must not contain the no-cache directive in the Cache-Control header.

Cache Control

When providing a Cache-Control is sent from your Serverless Function, it can include any of the following directives, separated by a comma:

  • s-maxage=N
  • max-age=N, public
  • max-age=N, immutable
Note: Above; where N is the number of seconds the response should be cached for.

As an example, you can set the Cache-Control header in your Next.js API Routes by using the res.setHeader method:

// pages/api/user.js

export default function handler(req, res) {
  res.setHeader('Cache-Control', 's-maxage=86400');
  res.status(200).json({ name: 'John Doe' });

A Next.js API Route that sends a JSON response and caches that response for one day.

Recommended Cache-Control

We recommend that you set your cache to have max-age=0, s-maxage=86400, with changing 86400 to the amount of seconds you want your response to be cached for.

This recommendation will tell browsers not to cache and let our edge cache the responses and invalidate when your deployments update, so you never have to worry about stale content.


The Vercel Edge Network supports a powerful recent extension to the Cache-Control header called stale-while-revalidate.

The benefit of using stale-while-revalidate is that we can serve a resource from our CDN cache while simultaneously updating the cache in the background with the response from your Serverless Function.

Some situations where stale-while-revalidate is of great value:

  • Your content changes frequently but it takes a significant amount of time to regenerate. For example, an expensive database query or upstream API request.
  • Your content changes infrequently but you want to have the flexibility to update it (to fix a typo, for example) and don't wait for cache to expire.

In both cases, we recommend using:

Cache-Control: s-maxage=1, stale-while-revalidate

Which tells our CDN: serve from cache, but update it, if requested after 1 second.

When the CDN receives a request with Pragma: no-cache (such as when the browser devtools are open), it will revalidate any stale resource synchronously, instead of in the background.

Cache Invalidation and Purging

Every time you deploy with a custom domain, the cache for that domain is purged. This means that users will never see content from a previous deployment on your custom domain and there is no need to invalidate it manually when deploying.