Skip to main content

Module 2: Networking & Web

Proxies

Forward vs reverse proxies — client egress control versus TLS termination, caching, load balancing, and how proxies relate to LBs, CDNs, and API gateways.

A proxy sits in the middle of traffic. Which side it “belongs to” changes everything — forward proxies represent clients; reverse proxies represent servers. System design interviews almost always mean the reverse-proxy / LB hop at the edge.

What you will learn

  • Contrast forward and reverse proxies in one clear sentence each
  • List reverse-proxy jobs: TLS, routing, cache, compression, WAF
  • Relate proxies to load balancers, CDNs, and API gateways
  • Place the reverse-proxy box correctly on a request-path diagram
  • Avoid common mix-ups with VPN, NAT, and sticky sessions
Left: clients exit through a forward proxy to the internet. Right: the internet hits a reverse proxy in front of app servers.
Forward proxy is for clients. Reverse proxy is the public front door for your servers.

What a proxy is

  • A proxy is an intermediary: clients and servers talk through it instead of directly. The value is policy, security, and performance at that middle hop.
  • Terminates or relays connections on behalf of one side
  • Can inspect, modify, cache, or block traffic (depending on type and config)
  • Hides topology: backends or clients need not be directly reachable
  • In diagrams, it is the intentional “middle box,” not an accident

Forward proxy

  • A forward proxy represents clients. Users (or company devices) send outbound traffic through it; destination servers see the proxy, not each laptop.
  • Corporate egress filtering and allow/deny lists
  • Access control and audit logging for outbound HTTP
  • Anonymity / IP hiding for clients (with privacy trade-offs)
  • Sometimes used for shared outbound caching of external content
  • Servers do not configure this — clients (or the enterprise network) do

Reverse proxy

  • A reverse proxy represents servers. Clients hit a public address; the proxy forwards to private backends and returns the response.
  • Backends stay on a private network — not exposed one-by-one to the internet
  • Single public hostname/IP for many services or instances
  • Classic interview box right after “Internet / users”
  • Nginx, Envoy, HAProxy, Traefik, and many cloud LBs play this role

Jobs a reverse proxy often does

  • One box can wear several hats. Name the jobs you actually need — do not imply magic.
  • TLS termination — certificates managed at the edge
  • Load balancing — pick a healthy upstream instance
  • HTTP caching and compression — cut origin work and bytes
  • Path/host routing — /api vs /static to different pools
  • WAF / basic filtering — block obvious bad requests early
  • Request logging, tracing headers, and rate limits at the door

Forward vs reverse — quick comparison

  • Use this side-by-side when the interviewer asks for the difference.
  • Who it serves — forward: clients; reverse: servers/origin
  • Who configures it — forward: client/enterprise; reverse: service owners
  • What the other side sees — forward: proxy IP as client; reverse: proxy as the public server
  • Typical goal — forward: egress control; reverse: edge security + scale
  • Interview default — assume reverse proxy unless told otherwise

Proxy vs load balancer

  • These terms overlap in practice. Be precise about the layer and the job.
  • Load balancer emphasizes distributing traffic across many healthy instances
  • Reverse proxy emphasizes representing the server, HTTP features, and routing
  • Many products are both: L7 LB = reverse proxy + balancing policy
  • L4 balancers may not parse HTTP — they forward connections, not paths
  • Say “L7 reverse proxy / LB” when you need host/path routing and TLS

Proxy vs CDN vs API gateway

  • Related edge boxes — different primary jobs. Keep them distinct on the whiteboard.
  • CDN — geo-distributed cache + reverse-proxy behavior for origin content
  • Reverse proxy / LB — usually at your VPC/edge, fans out to app instances
  • API gateway — reverse-proxy style front door with API auth, quotas, and routing to microservices
  • You can stack them: client → CDN → gateway/LB → services
  • Do not draw three boxes that all only say “auth” — assign one owner per concern

TLS, HTTP versions, and headers

  • Edge proxies change what backends see. Call out the details interviewers expect.
  • TLS often ends at the proxy; upstream may be HTTP on a private network
  • X-Forwarded-For / Forwarded headers carry the real client IP when needed
  • HTTP/2 or HTTP/3 at the edge can multiplex while upstream stays HTTP/1.1
  • Health checks and idle timeouts at the proxy protect against bad backends
  • WebSocket / gRPC need proxy support — not every L7 feature is free

Where proxies sit in the request path

  • Reuse the life-of-a-request canvas and place the proxy intentionally.
  • Public web: Client → CDN (optional) → reverse proxy/LB → app → cache/DB
  • Enterprise egress: App/laptop → forward proxy → internet
  • Service mesh sidecars are reverse-proxy cousins for east-west traffic
  • Keep app servers private; only the proxy (and CDN) need public exposure

Common misconceptions

  • These mix-ups cost easy points.
  • Calling a reverse proxy a “forward proxy” because traffic “goes forward”
  • Equating VPN with reverse proxy — VPN extends a private network; proxy mediates HTTP/TCP hops
  • Assuming a proxy always caches — caching is optional configuration
  • Exposing every microservice publicly “and also” drawing a reverse proxy
  • Forgetting health checks — a proxy to dead upstreams is just a faster outage

Interview framing

  • Use this order when the edge comes up in a design.
  • Define reverse proxy in one line and place it after the internet
  • List the jobs you need (TLS, LB, route, cache) — skip unused ones
  • Relate CDN / gateway only if the design has those concerns
  • Keep backends private; show health-checked upstream pools
  • Note client-IP forwarding if security or audit logs matter

Quick revision checklist

  • Say who the proxy represents: client (forward) or server (reverse).
  • Default to reverse proxy/LB in product designs.
  • Don’t confuse VPN with reverse proxy.
  • API gateway is a specialized reverse-proxy layer for APIs.
  • Mention TLS termination and X-Forwarded-For when relevant.
  • Keep origin/app instances off the public internet.

FAQs

Is a CDN a reverse proxy?

A CDN edge often acts like a geographically distributed reverse proxy plus cache for origin content. It is reverse-proxy-like, with a caching and PoP focus.

Is a load balancer the same as a reverse proxy?

They overlap. Balancing emphasizes distributing load; a reverse proxy emphasizes representing servers and HTTP features. Many L7 products do both.

Do I need both a forward and a reverse proxy?

For a typical internet product diagram, you need a reverse proxy/LB (and often a CDN). Forward proxies are for client/enterprise egress, not the public user path.

Where should TLS terminate?

Commonly at the reverse proxy, CDN, or L7 LB so certificates live at the edge. Some designs re-encrypt to backends for TLS everywhere.

How is an API gateway different?

A gateway is usually a reverse-proxy-style front door with API-centric features: auth, rate limits, routing to microservices, sometimes response aggregation. Same family, narrower product role.

What about Envoy sidecars / service mesh?

Sidecars are reverse proxies for service-to-service traffic (east-west): mTLS, retries, observability. Edge reverse proxies still handle north-south internet traffic.

Practice

Learner’s Task

  • Practice out loud for 8–10 minutes. Focus on placing the right proxy on a whiteboard path.
  1. Define forward vs reverse proxy in one sentence each, with one real-world example apiece.
  2. Draw Client → reverse proxy/LB → 3 app instances → DB, and list four jobs the proxy handles.
  3. Add an optional CDN box and explain how its role differs from your origin reverse proxy.
  4. Mark TLS termination and where X-Forwarded-For is set or consumed.
  5. Write a 4-sentence closing: which proxy, where it sits, jobs it owns, and one misconception you avoided.