cardinal-proxy

Crates.iocardinal-proxy
lib.rscardinal-proxy
version0.2.41
created_at2025-09-26 03:15:51.832556+00
updated_at2025-11-28 16:44:04.326295+00
descriptionPingora-based HTTP proxy implementation for the Cardinal gateway
homepagehttps://github.com/andrespirela/cardinal
repositoryhttps://github.com/andrespirela/cardinal
max_upload_size
id1855376
size153,469
(andreespirela)

documentation

README

cardinal-proxy

Pingora integration for Cardinal. CardinalProxy implements ProxyHttp and delegates request/response processing to the rest of the stack.

Key pieces

  • CardinalContextProvider: resolves an Arc<CardinalContext> from a Session. The default StaticContextProvider always returns the same context; more advanced deployments can plug in host-aware providers.
  • RequestContext: per-request cache of the resolved context, destination backend, and PluginRunner.
  • Middleware execution: PluginRunner::run_request_filters / run_response_filters are invoked at the right phases, so both Rust and WASM middleware can observe or mutate traffic.

Lifecycle

  1. Provider resolves a context.
  2. DestinationContainer selects the backend based on path/host.
  3. Request middleware runs; it can short-circuit with MiddlewareResult::Responded.
  4. Pingora connects to the upstream origin.
  5. Response middleware runs; optional logging is performed.

Consumers rarely touch this crate directly—Cardinal handles wiring—but understanding it is useful when implementing custom providers or debugging proxy behaviour.

Commit count: 0

cargo fmt