Request Limit Plugin
Restrict the size of incoming request bodies with RequestLimitHandlerPlugin to protect your server from oversized payloads.
Setup
Use RequestLimitHandlerPlugin to limit the size of incoming request bodies.
import { RequestLimitHandlerPlugin } from '@orpc/server/plugins'
const handler = new RPCHandler(router, {
plugins: [
new RequestLimitHandlerPlugin({
/**
* The maximum allowed request body size in bytes.
*/
maxBodySize: 1024 * 1024, // 1MB
}),
],
})
Learn More
For implementation details, see the source code.