middleware

Configure Forge's built-in HTTP middleware globally, by group, or per-route.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/weiloon1234/Forge-Starter --skill middleware-weiloon1234
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: middleware
Source: https://github.com/weiloon1234/Forge-Starter/tree/main/.claude/skills/middleware
Command: npx skills add https://github.com/weiloon1234/Forge-Starter --skill middleware-weiloon1234

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing and clarifying where Forge's built-in HTTP middleware runs (global, named groups, or per-scope) to control request handling, security headers, and performance safeguards.

Core Features & Use Cases

  • Understand the full built-in middleware set and their priority order.
  • Learn how to apply middleware globally, by named group, or per-route, including common concerns like compression, CORS, CSRF, rate limiting, and maximum body size.
  • Follow best practices to avoid pitfalls such as introducing custom middleware types or stacking groups in unsupported ways.

Quick Start

Identify routes needing cross-cutting concerns and attach the appropriate middleware by name group or per-route override.

Frequently Asked Questions about middleware

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

FAQPage Schema
How do I configure CORS and CSRF middleware for specific HTTP routes?▼

Forge's built-in HTTP middleware can be applied globally, by named group, or per-route to manage concerns like CORS and CSRF. Configuration uses the build() method to generate MiddlewareConfig wired in src/bootstrap/http.rs.

What is the execution order of built-in HTTP middleware in Forge?▼

Forge's built-in HTTP middleware runs in a fixed priority order. Understanding this sequence is necessary to correctly stack concerns like compression, rate limiting, and timeouts across your routes.

How do I apply rate limiting and compression globally in Forge?▼

You apply rate limiting and compression globally by configuring Forge's built-in HTTP middleware in src/bootstrap/http.rs. The build() method generates MiddlewareConfig to enforce these safeguards across all routes.

Can I create custom middleware types or stack named groups in Forge?▼

Forge does not support introducing custom middleware types or stacking named groups in unsupported ways. You must follow best practices using the fixed built-in middleware set to avoid configuration pitfalls.

How do I set maximum body size and timeouts for HTTP requests in Forge?▼

You set maximum body size and timeouts by attaching the appropriate built-in HTTP middleware per-route or globally. The build() method outputs the MiddlewareConfig needed to enforce these request handling safeguards.