routing-middleware

Configures Vercel Routing Middleware for request interception, rewrites, redirects, and geo-personalization.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Intercepting requests before the cache on Vercel requires correct middleware file placement, runtime selection, and matcher configuration, and the Next.js 16 rename of middleware.ts to proxy.ts adds migration confusion. ## Core Features & Use Cases - Request Interception Guidance: Explains Vercel Routing Middleware running before the cache with Edge, Node.js, and Bun runtimes across any framework. - Middleware Disambiguation: Clarifies the differences between Vercel Routing Middleware, Next.js 16 proxy.ts, and Edge Functions, including the middleware-to-proxy migration path. - Routing Configuration: Covers matcher patterns, @vercel/functions helpers (rewrite, geolocation, ipAddress, waitUntil), bulk redirects, project-level routes, and programmatic vercel.ts config. - Use Case: You want to geo-personalize a static homepage by rewriting US visitors to /us and international visitors to /intl using geolocation in middleware.ts. ## 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?

Create a middleware.ts or middleware.js file at the project root with a default exported function. Use config.matcher to scope which routes trigger it, and import helpers like rewrite and geolocation from @vercel/functions for non-Next.js frameworks.

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

Next.js 16 renames middleware.ts to proxy.ts, running 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@latest middleware-to-proxy) automates the 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 frameworks use helpers from @vercel/functions such as next(), rewrite(), and geolocation().

Can Vercel middleware run on the Bun runtime?

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

When should I not use Vercel Routing Middleware?

Avoid it for full Node.js API needs in Next.js (use proxy.ts), heavy business logic or database queries, and as the sole auth layer. For thousands of static redirects, use Bulk Redirects supporting up to 1M entries.

What are the request limits for Vercel middleware?

Middleware requests are limited to a 14 KB maximum URL length, a 4 MB maximum request body, and 64 headers totaling 16 KB. Using config.matcher avoids invoking middleware on unmatched paths, saving compute.