routing-middleware

Configures Vercel routing middleware intercepting requests before cache for rewrites, redirects, header injection.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you configure platform-level request interception so you can route traffic, personalize responses, and apply request rules before cache and page rendering.

Core Features & Use Cases

  • Request Rewrites and Redirects: Send users to different paths or destinations based on URL, headers, geolocation, or other request signals.
  • Header Injection and Lightweight Controls: Add custom headers, enable A/B tests, and implement simple defense-in-depth checks at the routing layer.
  • Framework-Agnostic Guidance: Works for Vercel deployments across Next.js and other frameworks, including scenarios that use middleware, proxy files, or vercel configuration.
  • Use Case: A product team can localize content for different countries, split traffic between variants, and enforce route-level policies without changing application code.

Quick Start

Ask the assistant to review your project routing setup and recommend the correct middleware, proxy, rewrite, or redirect configuration for your deployment.

Frequently Asked Questions about routing-middleware

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

FAQPage Schema
How do I configure Vercel middleware to intercept requests before cache?

Vercel middleware intercepts requests before cache and page rendering by configuring rewrites, redirects, and header injection in a middleware.ts file or vercel.json. This allows you to route traffic and apply request rules at the platform level.

Can I use Vercel routing middleware for A/B testing and geo-personalization in Next.js?

Yes, Vercel routing middleware supports A/B testing and geo-personalization in Next.js by evaluating request signals like geolocation and headers. It injects custom headers and splits traffic between variants without changing application code.

Does Vercel middleware support edge, Node.js, and Bun runtimes?

Vercel middleware supports Edge, Node.js, and Bun runtimes. You can configure request interception with matcher-based scoping and helper methods across these runtimes using middleware.ts or vercel.json.

What is the best way to apply redirects and rewrites based on request headers in Next.js?

The best way to apply header-based redirects and rewrites in Next.js is platform-level routing middleware. It evaluates request headers and URLs to send users to different paths or destinations before cache and page rendering occur.

How do I scope middleware execution to specific routes in a Next.js application?

You scope middleware execution to specific routes using matcher-based scoping configurations. This ensures your rewrites, redirects, and lightweight auth checks only intercept targeted request paths at the routing layer.