News Developer Tools

Vercel lets Routing Middleware skip client request bodies

Vercel's new skipMiddlewareRequestBody setting stops client request bodies from reaching Routing Middleware, cutting Fast Origin Transfer usage for middleware calls.

Vercel has added a setting that stops client request bodies from being sent to Routing Middleware, the code that runs before a request reaches a page or function. The option is called skipMiddlewareRequestBody. Vercel says it reduces incoming Fast Origin Transfer usage for middleware invocations.

Vercel says the change can also improve time to first byte, the delay before a browser receives the first piece of a response. The gain is largest for requests with large bodies, such as big uploads, because the middleware no longer receives that data.

The setting suits projects whose Routing Middleware never reads request bodies. Vercel Functions and rewrite targets still receive the body, so the data can be read and processed there.

Developers turn the option on by setting skipMiddlewareRequestBody to true in the project's vercel.json file. Projects that use a TypeScript configuration file, vercel.ts, add the same setting there. The change takes effect after the project is redeployed. The option defaults to false, so existing projects stay unchanged until it is enabled.

Source: Skip sending request bodies to Routing Middleware – Vercel.