Building an HTTP/2 & Rustls Edge Reverse Proxy with Cloudflare Pingora
Dynamic custom-domain routing for hosted applications demands an edge proxy that can reload routes in milliseconds without dropping active WebSocket or HTTP/2 streams. At AtharsTech, athars-proxy implements this control plane in pure Rust on top of Cloudflare Pingora.
Why Pure-Rust TLS and ALPN H2H1
Using Pingora with rustls eliminates C OpenSSL memory-safety pitfalls while enabling ALPN::H2H1 negotiation. Browsers multiplex concurrent API requests over HTTP/2 while upstream Node.js and Rust backends communicate seamlessly.
- Lock-Free Route Lookups: Routes are stored in a concurrent
DashMapkeyed by normalized hostnames. - Instant Route Hydration: On startup, the proxy hydrates routes from Redis hash
athars:routesand listens to PubSub channelathars:routes:events. - Fail-Closed Local IPC: Administrative mutations on loopback port
8099require constant-time Bearer token verification.
Symmetric SSRF Guards Across IPC and PubSub
Every upstream target passed through either HTTP IPC or Redis PubSub undergoes identical validation:
- Hostnames are sanitized and checked against private or loopback bypass patterns.
- Reserved internal ports (such as local engine port
8088or database ports) are rejected byFORBIDDEN_PORTS. - Percent-decoded path inspection and bounded IP rate-limit caches mitigate abusive scans before requests reach upstreams.
Learn more about our full stack on the Projects page or read about DirectAdmin and custom domain routing.