skip to content

In a design discussion one engineer says "put a load balancer in front of it", another says "no, an API gateway", and a third says "it is just a reverse proxy". What actually distinguishes those three roles, and can a single process play all of them?

level: middleimportance: should knowfreq 55%

answer

  1. three words, one underlying role
  2. which emphasis: pool, caller, or neither
  3. gateway must read requests, balancer need not
  4. ask which responsibilities live at this hop
  5. one process can wear all three hats

basics

~20 s

All three are reverse proxies; the words differ in emphasis. Load balancer stresses spreading traffic over a pool, API gateway stresses per-caller concerns such as authentication and quotas, and reverse proxy is the plain role underneath both. One process can be all three.

solid answer

~50 s

They are not three technologies — they are three emphases on one role. Every one of them is a reverse proxy: it fronts servers the client does not know about, terminates the client's connection and opens its own. "Load balancer" emphasises that there is a *pool* behind it and a choice of which member gets this request. "API gateway" emphasises *per-caller* concerns — identity, quota, and shaping the published surface — which means it has to understand the requests, not just the connections. A single nginx, HAProxy, Envoy or Caddy process can be configured to do all three at once, and in most systems one of them is. So the useful question in a design discussion is never which noun to use; it is *which responsibilities do we want at this hop*, because every responsibility you add there couples that hop more tightly to application semantics and to whoever owns them.

go deeper

for a junior

Know that all three sit in front of your servers and that the client talks to them instead of the application. Be able to say a load balancer spreads requests over several instances.

for a middle

Explain that the three names describe emphasis on one role, and name what actually differs: a pool and its health state, versus per-caller identity and quotas, versus neither. Say that one process can do all three.

for a senior

Show you decide by responsibility rather than label: what state each hop holds, whether it needs to read requests, who owns changes to it, and what an extra hop costs in latency and duplicated routing.

for a principal

Own where the roles should separate as the system grows, who operates each tier, and how much product knowledge you are willing to let migrate into shared infrastructure given its blast radius and release cadence.

## Three words, one role The fastest way to lose twenty minutes of a design review is to argue about whether the box is a load balancer or a reverse proxy. They are not competing categories. **Reverse proxy** is the role: an intermediary deployed by the service owner, which the client is unaware of, that terminates the client's connection and opens its own to a backend. Load balancers and API gateways are reverse proxies with different jobs foregrounded. ## Reverse proxy: the base role Stripped to the minimum, a reverse proxy accepts a connection meant for your service and relays it onward. Even with a single backend, that hop is useful: it is a place to terminate TLS, to serve static content, to add or strip headers, to enforce limits, and to swap what is behind it without the client noticing. If there is one backend and no per-caller logic, "reverse proxy" is the honest name. ## Load balancer: the pool is the point Call it a load balancer when the interesting decision is *which member of a pool* serves this request, and everything that follows from having a pool: knowing which members are healthy, choosing among them, deciding whether a given client should keep landing on the same one, and draining a member during a deploy. Those concerns exist whether the box parses requests or merely forwards connections — which is why a purely connection-level balancer is still a reverse proxy in role even though it can never read a URL path. The important consequence is *statefulness*. A pool-aware hop holds health state and, if you add affinity, per-client state. That state is what makes a load balancer something you operate rather than something you merely configure. ## API gateway: the caller is the point Call it a gateway when the interesting decisions are about *who is calling and what they are allowed to do*: authenticating the caller once at the edge, applying a quota or plan, and deciding which of your internal services is exposed under which published path. All of that requires understanding the request, so a gateway is necessarily request-level; you cannot make a connection-only proxy into a gateway. That is also where the real trade lives. A gateway holds knowledge that belongs to the product: which routes exist, who may call them, what a caller's plan allows. Product knowledge changes on the product's cadence, so the edge starts needing releases whenever a service changes — and a mistake there is a mistake for every service behind it. ## One process, several hats The general-purpose proxies overlap almost completely. nginx, HAProxy, Envoy and Caddy can each front a pool, terminate TLS, route by host and path, and enforce limits; several also do authentication and per-caller policy natively or through plugins. In a small system you will genuinely have one process that is simultaneously the reverse proxy, the load balancer and the gateway, and calling it by all three names is not wrong. The difference shows up as systems grow and the roles separate onto different hops — often a connection-level balancer at the front for capacity and failure isolation, a request-level tier behind it for routing, and gateway policy either in that tier or in a dedicated one. ## How to make the distinction useful Replace the noun with a checklist of responsibilities and ask, for each, whether you want it *here*: - Does this hop pick among several backends, and does it need health state to do it? - Does it need to read the request — path, method, headers — or only the connection? - Does it terminate TLS, and therefore hold a private key? - Does it know who the caller is, and enforce anything per caller? - Does it hold per-client state such as affinity or counters, and what happens when it restarts? - Who deploys a change to it, and how quickly, and what is the blast radius if that change is wrong? The answers, not the label, determine the design. Two hops that answer the checklist identically are the same thing whatever the vendor calls them. ## The failure mode of arguing about names When a team insists on a gateway product because "we need a gateway", the usual outcome is a second hop that duplicates the routing the first hop already does, adds latency, and splits ownership of routing across two teams. When a team insists on "just a reverse proxy" and then bolts per-caller quotas onto it by hand, they have built a gateway without admitting it, and without the operational tooling one usually brings. In an interview, say the three words describe emphasis rather than product, name the responsibilities that actually differ, and then show that you would decide by responsibility and ownership rather than by label.

  • Is a connection-level load balancer that never parses HTTP still a reverse proxy?
    Yes, in role: it fronts servers the client does not know about and the backend sees its address rather than the client's. What it cannot do is anything that needs the request — host or path routing, adding a forwarded header, per-route policy — which is exactly why an out-of-band mechanism is needed to convey the client's address to the backend.
  • When does calling a hop a "gateway" actually change a decision rather than just a name?
    When it starts holding product knowledge — which routes are published, who may call them, what a plan allows. At that point the hop changes on the product's cadence rather than the platform's, needs an owner who tracks API changes, and becomes a shared failure domain for everything behind it. A plain reverse proxy stays infrastructure and changes rarely.
  • A team wants a dedicated gateway product in front of an existing edge proxy. What would you check first?
    Whether the two hops would answer the same responsibility checklist. If the existing edge already routes by host and path and terminates TLS, a second hop that repeats that adds latency, a second place to misconfigure routing, and split ownership. The case for it has to rest on responsibilities the first hop genuinely cannot hold.

saying these in an interview costs you the question

  • A load balancer is L4 and a reverse proxy is L7 — that is the difference
  • An API gateway is a fundamentally different technology from a proxy
  • A reverse proxy cannot distribute traffic across several backends
  • You need three separate products to get the three roles
  • A gateway is just a load balancer with a nicer dashboard

context