Multi Field Extraction
A single json_body_field filter extracts multiple top-level JSON fields into separate request headers in one pass
Category: Practical
Task: A single json_body_field filter extracts multiple top-level JSON fields into separate request headers in one pass
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.
# Multi-Field Extraction
#
# A single json_body_field filter extracts multiple top-level
# JSON fields into separate request headers in one pass. The
# body is parsed once regardless of how many fields are
# configured.
#
# This example extracts both "model" and "user_id" from an
# LLM API request body. The model header drives routing to
# the correct inference backend while the user ID is
# forwarded for upstream logging and rate limiting.
#
listeners:
- name: inference-gateway
address: "0.0.0.0:8080" # dev value; binds all interfaces
filter_chains:
- extract-fields
- routing
filter_chains:
- name: extract-fields
filters:
- filter: json_body_field
fields:
- field: model
header: X-Model
- field: user_id
header: X-User-Id
- name: routing
filters:
- filter: router
routes:
- path_prefix: "/"
headers:
x-model: "model-alpha-1"
cluster: alpha_cluster
- path_prefix: "/"
headers:
x-model: "model-alpha-2"
cluster: alpha_v2
- path_prefix: "/"
cluster: default
- filter: load_balancer
clusters:
- name: alpha_cluster
endpoints:
- "10.0.1.1:8080"
- "10.0.1.2:8080"
- name: alpha_v2
endpoints:
- "10.0.2.1:8080"
- name: default
endpoints:
- "10.0.3.1:8080"