Body Size Limit With Extraction
Combines body_limits.max_request_bytes with json_body_field to enforce a global body ceiling while still performing body-based routing
Category: Practical
Task: Combines body_limits.max_request_bytes with json_body_field to enforce a global body ceiling while still performing body-based routing
Prerequisites: The product runtime and any backend services referenced by this configuration.
Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 and follow the first reverse-proxy tutorial to mount and start the configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
# Body Size Limit with Field Extraction
#
# Combines body_limits.max_request_bytes with json_body_field to
# enforce a global body ceiling while still performing
# body-based routing. Requests exceeding the limit receive
# 413 (Payload Too Large) before any extraction occurs.
#
# The global limit caps the StreamBuffer accumulation, so
# even if the filter declares no per-filter limit, the
# pipeline enforces the ceiling.
#
listeners:
- name: gateway
address: "0.0.0.0:8080" # dev value; binds all interfaces
filter_chains:
- extract-model
- routing
filter_chains:
- name: extract-model
filters:
- filter: json_body_field
field: model
header: X-Model
- name: routing
filters:
- filter: router
routes:
- path_prefix: "/"
cluster: backend
- filter: load_balancer
clusters:
- name: backend
endpoints:
- "127.0.0.1:3000"
# 1 KB ceiling: any request body over 1024 bytes is
# rejected with 413 before field extraction runs.
body_limits:
max_request_bytes: 1024
insecure_options:
allow_private_endpoints: true # example proxies to local backends