Data plane
BeaRustProxy implements Pingora’s ProxyHttp hooks. A request takes one loaded runtime snapshot and follows this implemented order:
- IP security: derive the client IP using trusted-proxy rules and block with
403before routing (test). - Bot evaluation: inspect the bounded request fingerprint, honor a valid clearance for challenges, then mark block/challenge outcomes (module, test).
- WAF headers and body: evaluate headers first, then buffer and inspect no more than
MAX_INSPECTION_BODY_BYTESthroughrequest_body_filter; a blocking verdict returns403and stops upstream body processing (engine, store, tests). Optional detector plugins can only escalate a verdict. - Route resolution: serve HTTP-01 challenges when applicable, otherwise resolve host/path against the snapshot router; no route produces
404(test). - Per-host authentication: evaluate the host-auth store after a route has been chosen (test).
- Rate limiting: select a global or host policy and record/limit the client key (store, test).
- Peer selection: choose a healthy pool backend, optionally through a
balance.selectplugin; no available pool/backend is503(balancer, tests). - Request transform: call an optional transform plugin before upstream forwarding. BeaRust then reasserts
Host,X-Forwarded-For, andX-Request-Id, so a plugin cannot spoof or remove them (test). - Upstream and response transform: Pingora sends the upstream request; a response-transform plugin uses bounded buffering and chunk framing when needed (hook, test).
- Logging, analytics, and failures: completion records redacted request logging and aggregate analytics exactly once.
fail_to_connectmay select a different backend according to the failure path;fail_to_proxywrites 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.