HTTP reverse proxy · Go 1.27
One request in.
Every feature out.
An nginx-style reverse proxy, written by hand in Go.
The request
Every request is a beam of light.
Prism takes it apart, then rebuilds it for the backend.
Dispersion
One beam in. Six rays out.
- Core proxy
- Routing & security
- Traffic
- Resilience
- Caching
- Operations
01 · Core proxy
Routes by host. Streams both ways.
TLS by SNI, longest-prefix routing, one pooled 32 KB buffer per direction.
waiting for a request…02 · Routing & security
Decides who gets in. And where they go.
Allow lists, Basic auth and API keys. Sticky canaries and shadow traffic.
03 · Traffic
Spreads the load. Meters the flood.
Four balancers, a per-IP rate limit and a bounded queue.
b3 is slow on purpose. Try least_conn.
04 · Resilience
Fails over before anyone notices.
Circuit breakers, outlier ejection, and retries on a budget.
make chaos killed a backend05 · Caching
Fetches once. Answers everyone.
RFC 9111, request coalescing, stale-while-revalidate.
06 · Operations
Reloads live. Shows its work.
A SIGHUP swaps the config without dropping a request.
Against nginx · 2026-10-21
Measured. Weak spots included.
One laptop, four pinned CPUs each, median of three runs. Full results ↗
Built to be broken
More test code than proxy code.
-raceQuickstart · Go 1.27
One binary. One YAML file.
$ make build && ./bin/prism -config prism.yaml
listeners: [{ addr: ":8080" }]
upstreams:
api:
balancer: least_conn
backends: [{ url: "http://10.0.0.1:8080" }]
health: { path: /healthz, interval: 5s }
routes:
- match: { path_prefix: "/api/" }
upstream: api
rate_limit: { per_ip: "5/s", burst: 5 }
retry: { attempts: 2, on: [connect_error, timeout] }
cache: { enabled: true }
admin: { listen: "127.0.0.1:9901" }
Hover a key to light its ray.
All of it, in one binary.
The docs build a reverse proxy up from first principles.