Home / System Design / Concepts / Proxies: Forward vs Reverse Concepts
CONCEPT SHEET · Concepts
Proxies: Forward vs Reverse
One-liner: A forward proxy acts for clients going out; a reverse proxy acts for servers receiving traffic. Same box, opposite direction.
Article Concepts © Arthur Bernier Jr 526 words 1 code block
Say this#
SAY THIS
Forward proxy — client-side intermediary; server sees the proxy's IP (Squid, corporate egress proxies, VPNs, Tor).
Reverse proxy — server-side intermediary; client sees only the proxy (Nginx, HAProxy, Envoy, Traefik, Caddy, Cloudflare).
TLS termination / offload — reverse proxy decrypts; backends speak plain HTTP or re-encrypt (TLS re-origination).
SSL passthrough — L4 forwarding of encrypted stream without decrypting.
X-Forwarded-For / X-Real-IP / Forwarded — headers carrying the original client IP through the proxy.
PROXY protocol — HAProxy's binary header preserving client IP at L4.
Transparent proxy — intercepts traffic without client configuration.
Egress proxy / NAT gateway — controls and audits outbound calls from your services.
Sidecar proxy — per-pod Envoy in a service mesh; both forward (outbound) and reverse (inbound).
Anonymity / caching / filtering — the forward proxy's jobs.
Load balancing / caching / compression / WAF — the reverse proxy's jobs.
WAF — web application firewall at the reverse proxy (Cloudflare, AWS WAF, ModSecurity).
How it works#
TEXT Copy
Forward: [client] -> [forward proxy] -> internet -> [server] server sees proxy IP Reverse: [client] -> internet -> [reverse proxy] -> [servers] client sees proxy IP
Reverse proxy request path:
Accept TCP, terminate TLS (cert from Let's Encrypt/ACM).
Parse HTTP, apply rules: redirect, rewrite, rate limit, auth subrequest, WAF.
Add X-Forwarded-For, X-Forwarded-Proto, request ID.
Pick upstream (load balance), forward with keep-alive connection pool.
Buffer/compress response (gzip/brotli), cache if cacheable, return.
Forward proxy uses: enforce egress allow-lists, cache package downloads, hide internal IPs, inspect outbound traffic, bypass geo-blocks.
Trade-offs#
Choice Pro Con Reverse proxy in front of apps TLS offload, central routing, caching, hides topology Extra hop (~1 ms), another thing to run HA TLS termination at proxy Cert management in one place, inspectable traffic Plaintext inside the network unless re-encrypted (mTLS mesh) SSL passthrough End-to-end encryption No L7 features at the proxy Forward egress proxy Security, auditing, caching Bottleneck, latency, config burden on clients Sidecar per service Uniform retries/mTLS/telemetry Resource overhead per pod, added latency
Numbers#
Nginx/HAProxy add roughly sub-millisecond to ~1 ms per hop; handle tens of thousands of req/s per core order of magnitude.
TLS handshake: 1 RTT (TLS 1.3), 2 RTT (TLS 1.2); terminating near the user saves tens of ms.
Envoy sidecar overhead: ~0.5-3 ms p99 and tens of MB memory per pod, order of magnitude.
In the interview#
SAY THIS
Mention it when you draw the LB: "Nginx/Envoy as a reverse proxy: TLS termination, compression, static caching, then route to app servers."
Say: "Client IP is preserved with X-Forwarded-For or PROXY protocol; rate limiting uses the real IP."
Follow-up: "Difference between reverse proxy and load balancer?" → "An LB is a reverse proxy whose primary job is distribution; reverse proxies also cache, terminate TLS, rewrite, and protect."
Follow-up: "When would you use a forward proxy?" → "Controlling egress from services: allow-list third-party APIs, audit, cache dependency downloads."
Creator
Written by Arthur Bernier Jr (Big Poppa Code). Arthur Bernier Jr — Big Poppa Code — is a software engineer, educator and entrepreneur: a former CTO at VC-backed startups and engineering lead at a billion-dollar company, mentor to 800+ engineers, now Senior Director of AI, Computer Programming and Cloud Computing at Per Scholas, and the host of the Deeper Than Code podcast. Everything on this page is his original teaching material.
bigpoppacode.io
License © Arthur Bernier Jr all rights reserved