Skip to content

requestLimit

const requestLimit: (config?) => Policy

Defined in: src/policies/traffic/request-limit.ts:30

Reject requests whose declared Content-Length exceeds maxBytes.

This policy checks only the Content-Length header. If the header is absent or invalid, the request passes through. Notably, requests using chunked transfer encoding (Transfer-Encoding: chunked) do not include a Content-Length header and will bypass this check entirely. For strict body size enforcement, combine this policy with a body-reading policy that enforces limits on the actual stream length.

RequestLimitConfig

Maximum byte limit and optional custom message.

Policy

A Policy at priority 5 (EARLY).