Why this matters
Both types of proxy stand between a client and a server. Which one faces which way flips the use case entirely. Candidates mix them up all the time. Interviewers notice.
Both types of proxy stand between a client and a server. Which one faces which way flips the use case entirely. Candidates mix them up all the time. Interviewers notice.
Clients configure their browser/system to route requests through the proxy. The proxy reaches out to the internet on the client's behalf. Server sees the proxy's IP, not the client's. Used for: egress filtering, caching, anonymity, content filtering in enterprises.
Clients think they're talking to your server directly; they actually hit the reverse proxy. The proxy forwards to upstream servers. Clients don't know or care about the topology behind the proxy. Used for: load balancing, TLS termination, caching, compression, WAF, hiding internal structure.
Almost every production web stack has one. The reverse proxy:
/static/* from disk directly; dynamic requests to the app.X-Forwarded-For (so backend knows client IP), strips internal headers.Reverse proxies introduce a subtle trap: your app server sees the proxy's IP, not the client's. If you log "client IP" naïvely, every entry says "the proxy." If you rate-limit by IP, one bad user defeats it by hiding behind the proxy.
Solution: the proxy sets X-Forwarded-For: <client-ip> (and X-Real-IP, Forwarded per RFC 7239). Your app reads that header instead of the TCP peer address.
Trap: this header is client-controllable. A curl user can send X-Forwarded-For: 127.0.0.1. Your proxy must strip any inbound X-Forwarded-For and set a fresh one. Otherwise attackers spoof their apparent IP.
With multiple proxies (CDN → LB → app), the header contains a comma-separated chain. Parse it carefully; the leftmost entry is the original client (assuming all proxies in the chain are trusted and set the header correctly).
Any code that reads X-Forwarded-For must be paired with "strip it from untrusted sources." Rate limiters, audit logs, and geo-IP checks all fail silently if this is wrong.
Runs more reverse proxies than anything else. Cheap, fast, config-driven. The "put Nginx in front" pattern is nearly universal.
Specialized in load balancing with proxy duties. Excellent for high-throughput, low-latency environments.
Every pod gets an Envoy sidecar acting as reverse proxy for incoming traffic and forward proxy for outgoing. Universal traffic management.
Edge nodes in 300+ cities act as reverse proxy to your origin. Caching, DDoS protection, TLS all at the edge.
URL shortener puts Nginx in front for static redirect caching. News feed uses Envoy as reverse proxy with stream-level load balancing. E-commerce uses CDN as the outermost reverse proxy layer.