Json Rpc

Extracts JSON-RPC 2.0 envelope metadata from request bodies and promotes method, id, and kind to request headers

Category: Practical
Task: Extracts JSON-RPC 2.0 envelope metadata from request bodies and promotes method, id, and kind to request headers

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.

# JSON-RPC Metadata Extraction
#
# Extracts JSON-RPC 2.0 envelope metadata from request
# bodies and promotes method, id, and kind to request
# headers. Enables routing and observability based on
# JSON-RPC method names. Batch arrays are rejected by
# default.
#
listeners:
  - name: default
    address: "127.0.0.1:8080"
    filter_chains:
      - rpc-pipeline

filter_chains:
  - name: rpc-pipeline
    filters:
      - filter: json_rpc
        max_body_bytes: 1048576 # 1 MiB
        batch_policy: reject
        on_invalid: reject
        headers:
          method: X-Json-Rpc-Method
          id: X-Json-Rpc-Id
          kind: X-Json-Rpc-Kind

      - filter: router
        routes:
          - path_prefix: "/"
            cluster: rpc-backend

      - filter: load_balancer
        clusters:
          - name: rpc-backend
            endpoints:
              - "127.0.0.1:3000"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends