Skip to main content
Version: 0.0.1

Data plane

BeaRustProxy implements Pingora’s ProxyHttp hooks. A request takes one loaded runtime snapshot and follows this implemented order:

  1. IP security: derive the client IP using trusted-proxy rules and block with 403 before routing (test).
  2. Bot evaluation: inspect the bounded request fingerprint, honor a valid clearance for challenges, then mark block/challenge outcomes (module, test).
  3. WAF headers and body: evaluate headers first, then buffer and inspect no more than MAX_INSPECTION_BODY_BYTES through request_body_filter; a blocking verdict returns 403 and stops upstream body processing (engine, store, tests). Optional detector plugins can only escalate a verdict.
  4. Route resolution: serve HTTP-01 challenges when applicable, otherwise resolve host/path against the snapshot router; no route produces 404 (test).
  5. Per-host authentication: evaluate the host-auth store after a route has been chosen (test).
  6. Rate limiting: select a global or host policy and record/limit the client key (store, test).
  7. Peer selection: choose a healthy pool backend, optionally through a balance.select plugin; no available pool/backend is 503 (balancer, tests).
  8. Request transform: call an optional transform plugin before upstream forwarding. BeaRust then reasserts Host, X-Forwarded-For, and X-Request-Id, so a plugin cannot spoof or remove them (test).
  9. Upstream and response transform: Pingora sends the upstream request; a response-transform plugin uses bounded buffering and chunk framing when needed (hook, test).
  10. Logging, analytics, and failures: completion records redacted request logging and aggregate analytics exactly once. fail_to_connect may select a different backend according to the failure path; fail_to_proxy writes a mapped error when no response exists and records the completion (tests).

The ordering matters: header/body security happens before forwarding, host auth/rate limits only after routing, and protected headers are restored after a request transform. Request-time policy snapshots are refreshed by the runtime synchronization path described in Runtime architecture.