• AI Cloud
      • AI Gateway

        One endpoint, all your models

      • Sandbox

        Isolated, safe code execution

      • Vercel Agent

        An agent that knows your stack

      • AI SDK

        The AI Toolkit for TypeScript

      • v0

        Build applications with AI

    • Core Platform
      • CI/CD

        Helping teams ship 6× faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Workflow

        Long-running workflows at scale

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up

Vercel Edge Middleware examples

Browse examples of how to use and apply Vercel Edge Middleware.

Filter Templates

Use Case

0

Framework

0

CSS

0

Database

0

CMS

0

Authentication

0

Experimentation

0

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Community

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:

Filter Templates

Use Case

1

Framework

0

CSS

0

Database

0

CMS

0

Authentication

0

Experimentation

0

Edge Redirects with Upstash

Redirect from a list of redirects both hardcoded and coming from Upstash (Redis), that get evaluated at the edge.
Edge Redirects with Upstash thumbnail

Modifying Request Headers in Middleware

Learn to add/update/delete request headers in a middleware.
Modifying Request Headers in Middleware thumbnail

A/B Testing Simple

By A/B testing at the edge, you'll reduce CLS from client-loaded experiments and improve your site's performance with smaller JS bundles.
A/B Testing Simple thumbnail

Filtering Query Parameters

Learn how to filter query params in Edge Middleware.
Filtering Query Parameters thumbnail

Hypertune Integration example

Learn to use Hypertune, a powerful feature flag, A/B testing, analytics and app configuration platform.
Hypertune Integration example thumbnail

Rewriting at the Edge using Upstash

Learn how to avoid calling several services by pre-checking stock at the edge using a redis cache.
Rewriting at the Edge using Upstash thumbnail

Bot Protection with DataDome

DataDome can provide real-time bot protection and other security protections to any website. In this template we'll be using it at the edge.
Bot Protection with DataDome thumbnail

Power Parity Pricing Strategies

Shows the differences between doing PPP at the edge using information from the geolocation object, Node.js SSR, and client-side rendering.
Power Parity Pricing Strategies thumbnail

Hostname Rewrites using Edge Middleware

Learn how to programmatically create unique content pages for your users with a multi-tenant infrastructure using Edge Middleware.
Hostname Rewrites using Edge Middleware thumbnail

IP Blocking with DataDome

DataDome can provide real-time bot protection, ip blocking, custom rules protection and other security protections to any website.
IP Blocking with DataDome thumbnail

LaunchDarkly Integration example

Learn how to set up the LaunchDarkly integration to read flags from Edge Config
LaunchDarkly Integration example thumbnail

A/B Testing with ConfigCat

ConfigCat is a service for feature flag and configuration management. In this template you'll be able to use feature flags at the edge.
A/B Testing with ConfigCat thumbnail

PostHog with Flags SDK and Next.js

An e-commerce example using static page variants with middleware rewrites determined by Flags SDK and PostHog.
PostHog with Flags SDK and Next.js thumbnail

Adding Cookies

Read and write cookies directly at the edge.
Adding Cookies thumbnail

Vercel Edge Middleware Rate Limit

Add rate limiting to your application with any frontend framework.
Vercel Edge Middleware Rate Limit thumbnail

Maintenance Page

This template shows how to quickly trigger a maintenance page using Edge Config
Maintenance Page thumbnail

Feature Flags with Optimizely

Learn how to use optimizely to conduct experiments at the edge.
Feature Flags with Optimizely thumbnail

Vercel Flags with Flags SDK and Next.js

An e-commerce example using static page variants with middleware rewrites determined by Flags SDK and Vercel Flags.
Vercel Flags with Flags SDK and Next.js thumbnail

Bot Detection with Botd

Botd is a browser library for bot detection. In this template we'll be using it alongside botd-integrations for bot detection at the edge.
Bot Detection with Botd thumbnail

User-Agent Based Rendering

Learn how to render a different page based on the User-Agent header.
User-Agent Based Rendering thumbnail

Blue-Green Deployments on Vercel

See how Vercel's Skew Protection feature enables production-ready blue-green deployments with just a few lines of code.
Blue-Green Deployments on Vercel thumbnail