Reverse Proxy vs Load Balancer: What's the Difference?
A load balancer is a kind of reverse proxy — here's exactly how they relate. Forward vs reverse proxy, what each does (TLS, caching, routing, health checks), and L4 vs L7. Fresher to senior.
🟢 Fundamentals · True fresher level → 🟠senior nuance
"What's the difference between a reverse proxy and a load balancer?" It's a deceptively common interview question, and a lot of people fumble it because the two overlap so much. The honest answer: a load balancer is a kind of reverse proxy — but with a specific job. Once you see how they relate, you'll never mix them up again. Let's build both from the ground up.
First, what's a "proxy" at all?
A proxy is a middleman that handles requests for someone else. There are two directions, and mixing them up is the classic beginner slip:
- Forward proxy: sits in front of clients and makes requests out to the internet on their behalf (e.g. a corporate proxy that filters what employees can reach). It represents the client.
- Reverse proxy: sits in front of servers and receives requests coming in from the internet. It represents the server. This is the one that matters for system design.
The reverse proxy
A reverse proxy is the single front door to your backend. Clients talk only to it; it decides what to do with each request and forwards it to the right internal server, then relays the response back. Because every request flows through it, it's the perfect place to handle cross-cutting jobs:
- TLS/SSL termination: decrypt HTTPS here so backend servers don't each have to.
- Caching: serve common responses directly without bothering the backend.
- Compression, security, routing: gzip responses, block bad traffic, and route
/apito one service and/imagesto another. - Hiding your backend: clients never see your real servers — better security and freedom to change them.
Nginx and HAProxy are the classic examples; they're used as reverse proxies constantly.
The load balancer
A load balancer is a reverse proxy with one starring role: you have many identical backend servers, and it distributes incoming requests across them so no single one is overwhelmed. It's the key to horizontal scaling — add more servers, and the load balancer spreads traffic over all of them.
🟠To decide which server gets each request, it uses an algorithm — round-robin (take turns), least-connections (send to the least busy), or a hash of the client (for stickiness). And crucially it runs health checks: if a server stops responding, the load balancer stops sending it traffic and reroutes to the healthy ones. That health-checking is what turns a pile of servers into a fault-tolerant system.
So how do they relate?
🟠Think of it as a hierarchy, not a rivalry:
| Reverse proxy | Load balancer | |
|---|---|---|
| Main job | Front door: routing, TLS, caching, security | Spread load across identical servers |
| Backends | Can be one, or many different services | Many identical copies of one service |
| Relationship | The general category | A reverse proxy specialised for balancing |
In practice one tool (Nginx) often does both at once — it's your reverse proxy (terminating TLS, routing /api) and load-balancing across your app servers. That's exactly why the terms blur.
L4 vs L7 (the senior detail)
🟠One nuance that impresses: load balancers work at different network layers.
- Layer 4 (transport): balances by IP and port without looking inside the request. Very fast, but "dumb" — it can't route based on the URL. Good for raw throughput.
- Layer 7 (application): reads the actual HTTP request, so it can route by path, header, or cookie (e.g.
/video→ video servers,/api→ API servers) and do smart things. More work per request, far more flexible.
Reverse-proxy features like path routing and TLS termination are inherently L7. Knowing this split — L4 for speed, L7 for smart routing — is a clean senior signal.
The interview-ready summary
"A reverse proxy is a server sitting in front of your backend that handles incoming requests — routing, TLS termination, caching, security, and hiding your servers. A load balancer is a reverse proxy specialised for one job: spreading traffic across many identical servers using algorithms like round-robin or least-connections, with health checks to drop dead servers. So a load balancer is a type of reverse proxy — and one tool like Nginx often plays both roles. For smart URL-based routing I'd use an L7 balancer; for raw speed, L4." Nail that and the overlap never trips you up again."
What to read next
- Load Balancing — the algorithms and health checks in depth
- Scalability Explained — why horizontal scaling needs a balancer
- Caching Strategies — the caching a reverse proxy can do
- ← The complete System Design guide (hub)