---
title: "Update Redirects in Realtime"
description: "Learn how to update redirects served by Vercel when redirects change in the CMS without redeploying."
url: "https://vercel.com/templates/next.js/update-redirects-in-realtime"
links:
  repository: "https://github.com/vercel/examples/blob/main/cdn/cms-webhook-update-redirects"
  demo: "https://cms-webhook-update-redirects.vercel.app/"
  deploy: "https://vercel.com/new/clone?demo-title=Update+Redirects+in+Realtime&demo-description=Learn+how+to+update+redirects+served+by+Vercel+when+redirects+change+in+the+CMS+without+redeploying.&demo-url=https%3A%2F%2Fcms-webhook-update-redirects.vercel.app%2F&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F6SlfOoRtFWCDcvpRcjeO2h%2F2d52dcef6d9545065a393d9a2eb16faf%2FScreenshot_2025-12-18_at_4.15.47%C3%A2__PM.png&project-name=Update+Redirects+in+Realtime&repository-name=update-redirects-in-realtime&repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Fblob%2Fmain%2Fcdn%2Fcms-webhook-update-redirects&from=templates&skippable-integrations=1&env=VERCEL_TEAM_ID%2CVERCEL_PROJECT_ID%2C%2CERCEL_BEARER_TOKEN&envDescription=Team+and+project+identifiers+and+credentials+for+which+project+to+update+redirects+for.&root-directories=List+of+directory+paths+for+the+directories+to+clone+into+projects&project-names=Comma+separated+list+of+project+names%2Cto+match+the+root-directories"
---

# Update Redirects in Realtime

Learn how to update redirects served by Vercel when redirects change in the CMS without redeploying.

# Update Vercel redirects on CMS changes

This example shows how to respond to CMS webhook events to update redirects served on Vercel.

## Demo

https://cms-webhook-update-redirects.vercel.app

## How to Use

You can choose from one of the following two methods to use this repository:

### One-Click Deploy

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/cdn/cms-webhook-update-redirects&project-name=cms-webhook-update-redirects&repository-name=cms-webhook-update-redirects&env=VERCEL_TEAM_ID,VERCEL_PROJECT_ID,VERCEL_BEARER_TOKEN)

### Clone and Deploy

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:

```bash
pnpm create next-app --example https://github.com/vercel/examples/tree/main/cdn/cms-webhook-update-redirects
```

Next, run Next.js in development mode:

```bash
pnpm dev
```

## Environment variables

- `VERCEL_TEAM_ID` – Vercel team ID to update redirects for
- `VERCEL_PROJECT_ID` – Vercel project ID to update redirects for
- `VERCEL_BEARER_TOKEN` - Vercel access token for this team

## How it works

1. The Vercel project runs in production as normal. It can optionally use [Build-time redirects via a CMS](https://vercel.com/templates/cdn/bulk-redirects-via-a-cms) example to load some redirects at deployment time.
2. When a redirect is updated on the CMS, a webhook handler receives a request with the updated redirect. That code uses the [Vercel SDK](https://vercel.com/docs/rest-api/reference/sdk) to modify the redirects served by Vercel. This can happen without a new deployment.
3. After creating a new redirect, the webhook handler then promotes that new version to production with the changed value. Redirects are created in a staged version and must be explicitly promoted to production before being served to end users.

## Related Templates

### [Bulk Redirects via a CMS](https://vercel.com/templates/next.js/bulk-redirects-via-a-cms)

Learn how to create redirects via Contentful, synced at build time to Vercel’s CDN using vercel.ts

---

## Additional documentation

The [Vercel Knowledge Base](https://vercel.com/kb) contains guides and answers to common questions about Vercel, including deployment, framework configuration, domains, caching, and troubleshooting.
