Skip to main content
The requestsize policy rejects requests whose body exceeds a configured limit, before they’re forwarded upstream — a cheap guard against accidental or abusive oversized prompts.
SettingTypeDefaultNotes
allowed_payload_sizeint10Max body size, in size_unit.
size_unitenummegabytesbytes · kilobytes · megabytes.
max_chars_per_requestint100000Max characters in the request content.
require_content_lengthboolfalseReject requests with no Content-Length.
{
  "slug": "requestsize",
  "settings": {
    "allowed_payload_size": 5,
    "size_unit": "megabytes",
    "max_chars_per_request": 50000
  }
}
Run it as a global policy at pre_request to set a gateway-wide ceiling, or scope it to specific consumers for tighter per-tenant limits.