Production-grade reverse proxy

A reverse proxy in Go designed the way real infrastructure is, with atomic config swaps, explicit failure semantics and operational safety built in from the start.

The design idea

Every request runs against an immutable snapshot of configuration. Config changes are applied atomically, so in-flight requests are never disrupted, there is no partial state, and there is no race between routing and policy.

Requests flow through the listener, router, traffic management, middleware, cache and upstream pool, all reading one immutable snapshot. The control plane validates new config into the next snapshot and swaps it in atomically.The data planeClientListenerRouterTrafficMiddlewareCacheUpstreamsservicesSnapshot n, in useimmutable routes, policies and pools; every request reads oneThe control planeNew configsigned bundleValidate, compileSnapshot n + 1atomic swapin-flight requests finish on snapshot n
Two planes: requests read one snapshot; change builds the next one and swaps it in.

What it does

  • Traffic: retries with strict budgets, request coalescing and caching, canary traffic splits, and progressive rollout
  • Resilience: circuit breakers, active and passive health checks, outlier detection and overload protection
  • Extensibility: external plugins with crash isolation and time limits
  • Security: TLS and mTLS, an admin API separated from the data plane and protected by mutual TLS and tokens, and signed config bundles with rollback
  • Operations: Slowloris protection, graceful shutdown with draining, snapshot memory pressure control and goroutine leak prevention

Failure is a first-class concept

Every failure mode is explicit, documented and tested. Cache failures never fail requests. Plugin failures are isolated and time-bound. Breakers fail fast. Nothing fails silently.

The repository documents its design invariants, failure semantics, threat model, operational playbooks and SLO guidance, and integration and invariant tests make the core guarantees hard to break.

A companion service

The same thinking went into a distributed rate limiter, a standalone service built around the same idea of immutable snapshots and explicit failure modes.