Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Redirect from a list of redirects both hardcoded and coming from Upstash (Redis), that get evaluated at the edge.

Astro landing page starter with gradient background, responsive hamburger/dropdown menu, and switchable floating/fullscreen headers.
Edge Redirects with Upstash is a Next.js boilerplate for evaluating URL redirects at the edge, combining hardcoded JSON rules with live redirects stored in Upstash Redis.
This template is a Next.js example from Vercel that demonstrates how to handle both static and dynamic redirects inside an Edge Middleware function. It accepts a list of redirect rules — 1,000 hardcoded in a JSON file and 9,000 stored in Upstash Redis — and returns the appropriate HTTP redirect response when a request matches. The template runs on the Vercel edge network and is styled with Tailwind CSS.
pnpm create next-app.scripts/upstash.js populates Redis with the demo redirects; set POPULATE_REDIS to false to skip this.After cloning and setting the Upstash environment variables, run the script in scripts/upstash.js to populate Redis with the 9,000 redirects. When a request hits the Next.js edge middleware, it first checks the hardcoded JSON redirects; if no match is found, it queries Upstash for a Redis-stored rule and responds with the redirect. The POPULATE_REDIS flag lets you run without the Redis population step.
Yes, to populate and read the Redis-backed redirects you need an Upstash account and must set the UPSTASH_REST_API_DOMAIN and UPSTASH_REST_API_TOKEN environment variables.
Yes, set POPULATE_REDIS to false in your environment file. The hardcoded JSON redirects will still work without Upstash.
The demo seeds 10,000 redirects total: 1,000 hardcoded in JSON and 9,000 stored in Upstash Redis.
