Configuring Regions for Vercel Functions

Learn how to configure regions for Vercel Functions.
Table of Contents

The Vercel platform caches all static content at the edge by default. This means your users will always get static files like HTML, CSS, and JavaScript served from servers that are closest to them. See Regions for a full list of our regions.

In a globally distributed application, the physical distance between your function and its data source can impact latency and response times. Therefore, Vercel allows you to specify the region in which your functions execute, ideally close to your data source (such as your database).

The default Function region is Washington, D.C., USA (iad1) for all new projects.

To change the default region in the dashboard:

  1. Choose the appropriate project from your dashboard on Vercel
  2. Navigate to the Settings tab
  3. From the left side, select Functions
  4. Use the Function Region dropdown to select your project's default region:
    The Function Region setting in a Vercel project's dashboard
    The Function Region setting in a Vercel project's dashboard

To change the default region in your vercel.json configuration file, add your region code to the "regions" key:

vercel.json
{
  "regions": ["sfo1"]
}

Additionally, Pro and Enterprise users can deploy Serverless Functions to multiple regions: Pro up to three regions, and Enterprise to unlimited regions. To learn more, see location limits.

To change the default regions in your vercel.json configuration file, add the region code(s) to the "regions" key:

vercel.json
{
  "regions": ["sfo1", "lhr1", "sin1"]
}

Enterprise users can also use functionFailoverRegions to specify regions that a Serverless Function should failover to if the default region is out of service.

Use the vercel --regions command in your project's root directory to set a region. Learn more about setting regions with the vercel --regions command in the CLI docs.

To learn more about the regions that you can set for your Functions, see the region list.

Vercel Functions have multiple availability zone redundancy by default. Multi-region redundancy is available depending on your runtime.

Setting failover regions are available on Enterprise plans

Enterprise teams can enable multi-region redundancy for Vercel Functions using Node.js.

To automatically failover to closest region in the event of an outage:

  1. Select your project from your team's dashboard
  2. Navigate to the Settings tab and select Functions
  3. Enable the Function Failover toggle:

To manually specify the fallback region, you can pass one or more regions to the functionFailoverRegions property in your vercel.json file:

vercel.json
{
  "functionFailoverRegions": ["dub1", "fra1"]
}

The region(s) set in the functionFailoverRegions property must be different from the default region(s) specified in the regions property.

During an automatic failover, Vercel will reroute application traffic to the next closest region, meaning the order of the regions in functionFailoverRegions does not matter. For more information on how failover routing works, see functionFailoverRegions.

You can view your default and failover regions through the deployment summary:

Failover regions for your Serverless Functions shown in the deployment summary.
Failover regions for your Serverless Functions shown in the deployment summary.

Region failover is supported with Secure Compute. See Region Failover to learn more.

Last updated on November 20, 2024