Load balancer vs API gateway vs reverse proxy
Three boxes that sit in front of your servers — and do very different jobs.
A reverse proxy fronts servers and forwards requests; a load balancer is a reverse proxy specialized in spreading traffic across many identical backends; an API gateway adds application-level concerns like auth, rate limiting, routing and aggregation. They often stack together.
Reverse proxy
A reverse proxy sits in front of one or more servers and forwards client requests to them, so clients never talk to the backends directly. Along the way it commonly terminates TLS, caches responses, compresses payloads and hides the internal topology. It is the general category from which the other two are specializations.
Load balancer
A load balancer is a reverse proxy whose defining job is distribution — spreading incoming requests across a pool of identical, healthy backends. It uses an algorithm like round-robin, least-connections or hashing to pick a target, continuously health-checks the pool, and reroutes around any instance that fails. This is what turns many interchangeable servers into one resilient, scalable service.
API gateway
An API gateway operates at the application layer and owns cross-cutting concerns rather than raw traffic spreading. It authenticates and authorizes callers, enforces rate limits and quotas, routes requests to the right service by path or header, and can aggregate several backend calls into one response. It is the single, policy-aware front door to a fleet of microservices.
Working together
These roles are not competitors — in real deployments they stack, each doing the layer it is best at. A common chain is clients to an API gateway for policy and routing, then to a load balancer for distribution, with reverse proxies fronting individual services. Understanding which box owns which responsibility is what the interview question is really testing.
Why these three get confused
Reverse proxy, load balancer and API gateway all sit in the same physical spot — between your clients and your servers — and all forward requests, so people use the names interchangeably. But they describe different jobs, and interviewers ask about them precisely because being able to separate the roles proves you understand what an edge tier is actually for.
The cleanest way to hold them in your head is as a family tree. A reverse proxy is the general concept: anything that fronts backend servers and forwards traffic on their behalf. A load balancer is a reverse proxy that specializes in one thing — spreading load across many identical backends. An API gateway is a reverse proxy that specializes in a different thing — enforcing application-level policy for an API. They overlap because they share a lineage, not because they are the same tool.
The reverse proxy — the base concept
A forward proxy sits in front of clients and acts on their behalf (think a corporate web filter). A reverse proxy is the mirror image: it sits in front of servers and acts on their behalf, so the outside world talks to the proxy and never learns the real backend addresses.
That single position unlocks a lot of value that has nothing to do with load:
- TLS termination — decrypt HTTPS once at the edge so backends can speak plain HTTP internally.
- Caching and compression — serve repeated responses directly and shrink payloads.
- Security and abstraction — hide internal topology, present one hostname, and centralize a choke point for filtering.
Nginx, HAProxy and Envoy are the canonical examples, and crucially the same piece of software can be configured to behave as a plain proxy, a load balancer, or part of a gateway.
The load balancer — distribution and resilience
A load balancer is a reverse proxy whose reason for existing is to answer the question "which of my many identical backends should this request go to?" It exists to make horizontal scaling and high availability real.
Two design axes matter. The first is the algorithm — round-robin cycles through servers evenly, least-connections favors the least busy, and consistent hashing pins a given client or key to the same server (useful for sticky sessions or cache locality). The second is the layer it works at: a Layer 4 load balancer routes on IP and port (fast, protocol-agnostic), while a Layer 7 load balancer reads the HTTP request and can route on path, header or cookie (smarter, slightly costlier).
The feature that ties it together is health checking. The balancer constantly probes its pool and quietly stops sending traffic to any instance that fails, which is exactly what lets a fleet survive individual crashes without a human noticing.
The API gateway — application-level policy
An API gateway moves up the stack from "which server" to "what is this request allowed to do." It is the managed front door to an API, almost always a set of microservices, and it centralizes the concerns that would otherwise be duplicated in every service.
Typical gateway responsibilities include authentication and authorization (validate the token once, reject bad callers at the edge), rate limiting and quotas (protect backends from abuse and enforce plan limits), request routing (map /users and /orders to different services), and sometimes aggregation (fan out to several services and compose one response). Because it understands the application protocol, it is also the natural home for API keys, request transformation, logging and observability. AWS API Gateway, Kong and Apigee are common implementations.
The trade-off is that a gateway is a rich, application-aware component that can become a bottleneck or a single point of failure if under-provisioned, so it is run redundantly and kept as thin as the policy allows.
How they compose in production
The mistake is treating this as an either/or choice. In a real system they layer, each handling the concern it is best suited to. A very common request path is: client → API gateway (authenticate, rate limit, route) → load balancer (spread across healthy instances) → a reverse proxy or sidecar in front of each service.
A useful rule of thumb for placing responsibility: if the concern is about traffic — how to spread it, how to survive a dead node — it belongs to the load balancer. If the concern is about the request's meaning — who is calling, are they allowed, where should this path go — it belongs to the gateway. And the plain reverse proxy is simply the shared substrate both are built on. Knowing which box owns which job is what lets you design an edge tier that is scalable, secure and debuggable rather than a tangle of overlapping features.
Reverse proxy: hides backends, terminates TLS, caches, and forwards requests.
Load balancer: distributes traffic across backends (round-robin, least-connections, hashing) and health-checks them.
API gateway: single entry point that handles auth, rate limiting, routing, and response aggregation for microservices.
They compose: clients → gateway → load balancer → services is a common chain.
Quick quiz
Which component is the natural home for authentication and rate limiting?
A load balancer is best described as…
A crash course on scalability
How one box on a laptop becomes a system that serves millions.
What happens when you type google.com
The single most-asked interview question, animated end to end.
REST vs GraphQL
Two ways to shape an API — resources and endpoints, or one flexible query.