System Design Academy

Saving…

Lesson 7 of 8 in Module 20 of 54 lessons complete

Forward Proxies, Reverse Proxies & API Gateways

Module 2, lesson 7Concept10 min

Definition

Proxy

In plain English
A proxy is a server that sits between a client and another server and passes messages along.
Think of it like
It is like an assistant who makes calls on someone's behalf.

Forward proxy

In plain English
A forward proxy acts for a group of clients, sending their requests out to the internet.
Think of it like
It is like a company mailroom that sends all staff letters under the company's name.

Reverse proxy

In plain English
A reverse proxy acts for a group of servers, receiving requests from the internet and passing them inside.
Think of it like
It is like hotel reception taking every visitor's request and forwarding it to the right room.

Why it exists

Five services check logins differently, and users see inconsistent failures. You need one shared place to enforce the entry rules.

A hospital also needs rules for outgoing staff browsing. The direction of the traffic determines which kind of proxy helps.

How it works

API gateway

In plain English
An API gateway is a reverse proxy for APIs that also does shared jobs such as checking logins, limiting request rates and routing to many services.
Think of it like
Like an airport security checkpoint every passenger passes before reaching any gate.

Rate limiting

In plain English
Rate limiting caps how many requests one client may send in a period of time.
Think of it like
Like a ride letting each guest go once per hour.

Caching and compression

In plain English
Caching reuses saved responses, while compression reduces the number of bytes needed to represent those responses.
Think of it like
It is like keeping spare handouts and folding each one into a smaller envelope.

Laptops send through a forward proxy to the internet. Internet clients reach servers through a reverse proxy in the second group.

Forward and reverse proxies represent opposite sides of a request.

Laptops send through a forward proxy to the internet. Internet clients reach servers through a reverse proxy in the second group.

RoleActs forTypical jobs
Forward proxyClientsControl outgoing access
Reverse proxyServersReceive requests, cache responses, compress data
Load balancerServer groupSpread incoming traffic among healthy copies
API gatewayAPI servicesCheck logins, limit request rates, route paths

Examples

Apply staff browsing rules

The hospital sends staff web browsing through a forward proxy. It blocks unsafe destinations and records access for later review.

The proxy represents hospital clients when they contact outside sites. Its rules belong to the organisation making those requests.

  • Control which destinations staff devices reach.
  • Record access according to the hospital’s policy.

The insight

A forward proxy enforces the client side’s rules.

Trade-offs

Pros

  • Share HTTPS, response reuse and login verification.
  • Hide internal service addresses.

Cons

  • Add another forwarding step.
  • Protect another component against failure.
  • Keep booking rules from accumulating in the gateway.

Use when

  • Use one domain for several services.
  • Apply consistent entry rules across services.

Avoid when

  • Avoid a redundant layer for one small service.
  • Avoid moving every application decision into the gateway.

Quick check

A school routes all student web traffic through one server that blocks some sites. What is it?
Five services each check login tokens differently, causing bugs. What fixes this most directly?

Takeaways

  • Forward proxies act for clients; reverse proxies act for servers.
  • API gateways share entry checks, while many load balancers also provide reverse proxying.
  • Keep shared entry rules at the front door and service-specific decisions within services.

Try the quick check above whenever you feel ready.

Previous: Load-Balancing Algorithms & Health Checks