routing-middleware

Configures Vercel Routing Middleware for request interception, rewrites, and redirects before cache.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/ridhijain709/AIPORSCHE --skill routing-middleware-ridhijain709
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: routing-middleware
Source: https://github.com/ridhijain709/AIPORSCHE/tree/main/.agents/skills/routing-middleware
Command: npx skills add https://github.com/ridhijain709/AIPORSCHE --skill routing-middleware-ridhijain709

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @vercel/functions, @vercel/config, @vercel/global-config.

What problem does it solve? It guides developers through implementing platform-level request interception on Vercel, clarifying the differences between Routing Middleware, Next.js 16 proxy.ts, and Edge Functions so requests are handled at the correct layer. ## Core Features & Use Cases - Request Interception Guidance: Explains how to write middleware.ts with default exports, matcher configuration, and Edge, Node.js, or Bun runtimes. - Rewrite and Redirect Patterns: Covers geo-personalization, A/B testing with Global Config, header injection, and background processing via waitUntil. - Migration Support: Detects deprecated middleware.ts usage in Next.js 16 and directs migration to proxy.ts with the Node.js runtime. - Use Case: You want to serve different homepage variants by country. The Skill shows how to use geolocation from @vercel/functions with a rewrite in middleware.ts scoped by a matcher. ## Quick Start Ask the assistant to create a Vercel middleware.ts file that rewrites requests based on the visitor's country using geolocation.

Frequently Asked Questions about routing-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Vercel Routing Middleware for rewrites?▼

Create a middleware.ts file at the project root with a default exported function that returns rewrite(url) from @vercel/functions. Use config.matcher to scope which paths trigger the middleware and avoid unnecessary invocations.

What is the difference between middleware.ts and proxy.ts in Next.js 16?▼

Next.js 16 renames middleware.ts to proxy.ts, running only on the Node.js runtime at the network boundary. The exported function must also be renamed from middleware to proxy, and a codemod (npx @next/codemod middleware-to-proxy) automates migration.

Does Vercel middleware work with frameworks other than Next.js?▼

Yes, Vercel Routing Middleware is a platform feature that works with SvelteKit, Astro, Nuxt, or any deployed framework. Non-Next.js projects import helpers like rewrite, geolocation, and ipAddress from @vercel/functions.

Can I run Vercel middleware on the Bun runtime?▼

Yes, add bunVersion to vercel.json and set the middleware runtime to nodejs; Bun transparently replaces the Node.js runtime. The feature is in Public Beta and supports Next.js, Express, Hono, and Nitro.

When should I not use Vercel Routing Middleware?▼

Avoid it for heavy business logic, database queries, or as the sole auth layer. Use Bulk Redirects for thousands of static redirects, Edge Functions for general edge compute, and server-side framework features for full Node.js API needs.