routing-middleware

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Intercepting requests at the platform level before the cache requires knowing which middleware concept applies, which runtime to use, and how to configure matchers and routing rules correctly across frameworks on Vercel. ## Core Features & Use Cases - Request Interception Guidance: Implement rewrites, redirects, header injection, and geo-personalization in middleware.ts running before the cache on Edge, Node.js, or Bun runtimes. - Middleware Disambiguation: Distinguish Vercel Routing Middleware, Next.js 16 proxy.ts, and Edge Functions, including the middleware-to-proxy migration path. - CDN Routing Configuration: Configure bulk redirects, project-level routes, and deployment config routes via vercel.json or type-safe vercel.ts with @vercel/config. - Use Case: You want to A/B test your homepage by rewriting requests based on a Global Config flag, using a matcher to scope middleware and avoid unnecessary invocations. ## 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 and redirects?

Create a middleware.ts file at the project root with a default exported function that returns rewrite() or redirect responses. Use config.matcher to scope which paths 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, which runs only on the Node.js runtime and clarifies its network-boundary role. The exported function must be renamed from middleware to proxy, and you can migrate with npx @next/codemod@latest middleware-to-proxy.

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. For non-Next.js frameworks, import helpers like next, 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. Bun support is in Public Beta and reduces average latency by about 28% in CPU-bound workloads.

When should I not use Vercel Routing Middleware?

Avoid it when you need full Node.js APIs in Next.js (use proxy.ts), general edge compute (use Edge Functions), heavy business logic, or thousands of static redirects (use Bulk Redirects). It should also never be the sole auth layer.

How do I update Vercel routing rules without redeploying?

Use project-level routes, which take effect instantly without a deployment. Manage them via the Dashboard CDN Routing tab, the REST API endpoints under /v1/projects/{projectId}/routes, the Vercel CLI, or the @vercel/config SDK helpers.