Forward Proxy vs Reverse Proxy: The Only Rule You Need
π― The Questionβ
"What is the difference between a Forward Proxy and a Reverse Proxy? What is the golden rule to never confuse them in a System Design interview?"
β‘ 30-Second Elevator Pitchβ
Here is the Golden Rule:
- Forward Proxy protects the CLIENT (The server doesn't know who the real client is).
- Reverse Proxy protects the SERVER (The client doesn't know which backend server actually answered).
- Forward Proxy (e.g. Corporate VPN, Tor):
- Sits between a private client network and the public internet.
- Used for content filtering, bypassing geo-restrictions, and anonymizing client IP addresses.
- Reverse Proxy (e.g. NGINX, Cloudflare, HAProxy):
- Sits between the public internet and private backend server fleets.
- Used for Load Balancing, SSL Termination, Caching, and DDoS protection.
π§ Under-the-Hood: Forward vs. Reverse Proxy Architectureβ
π¬ Core Use Casesβ
Forward Proxy Use Cases:β
- Enterprise Security: Block employees from accessing malicious websites.
- Cache Outbound Traffic: Cache shared external resources inside a school/office network.
- Anonymity: Tunnel traffic through rotating IP addresses.
Reverse Proxy Use Cases:β
- SSL Termination: Decrypt HTTPS at the proxy layer so internal microservices communicate via high-speed plaintext HTTP.
- Load Balancing: Distribute traffic evenly across 50 internal Kubernetes pods (Round Robin, Least Connections).
- Web Acceleration & Caching: Cache static assets (CSS, JS, images) at edge proxies to reduce backend database load.
π Comparison Matrix: Forward Proxy vs. Reverse Proxyβ
| Dimension | Forward Proxy | Reverse Proxy |
|---|---|---|
| Whom does it represent? | The Client | The Server |
| Who knows its existence? | Client explicitly configures proxy | Client believes proxy is the origin server |
| IP Visibility | Hides client IP from internet | Hides private backend server IPs from clients |
| Primary Deployment | Corporate LANs, VPNs, Tor | NGINX, Cloudflare, AWS ALB, Envoy |
| Main Functions | Anonymity, content filter, bypass geo-blocks | Load balancing, SSL offload, caching, DDoS defense |
π‘ What Interviewers Ask Next (Follow-Up Traps)β
-
"How does a backend server know the client's real IP address when behind a Reverse Proxy?"
- Answer: The reverse proxy appends the client's original IP address to the
X-Forwarded-ForandX-Real-IPHTTP request headers before forwarding the packet to backend services.
- Answer: The reverse proxy appends the client's original IP address to the
-
"What is the difference between a Reverse Proxy and an API Gateway?"
- Answer: A Reverse Proxy handles network-level routing, SSL termination, and load balancing (e.g. NGINX). An API Gateway is a specialized reverse proxy that also handles application-level concerns such as JWT authentication, API rate limiting, request validation, and protocol translation (e.g. gRPC-to-JSON).
Interview Answer: A forward proxy acts on behalf of clients to control outbound traffic and hide client identities. A reverse proxy acts on behalf of backend servers to intercept inbound traffic, providing load balancing, SSL termination, caching, and infrastructure security.
πΊ Video Explanationβ
Never Study in Isolation. Join Binary Dose.
Connect with fellow engineers, clear conceptual doubts, and get 2 visual breakdowns & engineering mental models daily across our community channels.
Discord Community
Start at #welcome-and-rules, say hello in #general-chat, clear doubts, and collaborate with engineers worldwide.