Networking / Forward proxies

Forward proxies

A forward proxy fetches web pages on behalf of the clients behind it. Follow one request through it to see what it hides, what it can block or reuse, and what it is not.

Beginner7 steps~7 min
Client — wants a page from the web
Proxy — fetches on the client’s behalf
Server — the website being asked
// THE SHORT VERSION

In 30 seconds

A forward proxy is a go-between that clients ask to fetch web pages for them. The website sees the proxy’s address instead of the client’s.

Because every request passes through it, the proxy can block some sites, keep a log, and reuse copies of files it has already fetched. Offices and schools use one as the single door to the web.

A reverse proxy does the same job for servers instead of clients. A VPN hides the address too, but carries all of a device’s traffic through an encrypted tunnel.

Forward proxies, step by step

STEPS01 / 07

Shown with plain HTTP. For HTTPS a proxy normally just relays the encrypted bytes: it sees the site’s name but not the pages, so it can block by site but cannot cache or read them.

STEP 01 / 07 Direct: the server sees you
THE MATH
direct connection server sees: 192.0.2.23
  1. Step 1: Direct: the server sees you. Every request carries the sender’s address, because the reply has to find its way back. When a client connects straight to example.com, the server therefore learns where the request came from, here 192.0.2.23, and can log it.
  2. Step 2: Ask a go-between. A forward proxy is a go-between the client asks to fetch things on its behalf. The proxy makes the request from its own address and passes the reply back. The server sees 203.0.113.5 and never the client, unless the proxy chooses to pass the address on in a header. The proxy itself sees everything.
  3. Step 3: On the clients’ side. What makes it a forward proxy is whose side it is on: it stands in front of the clients and is set up in their browsers or devices. An office or school points every machine at one proxy, so all web traffic from inside leaves through a single, controlled door.
  4. Step 4: Filtering. Since every request passes through it, the proxy can check each one against a list of rules. A request for an allowed site is forwarded as usual. A request for a blocked site never leaves the building: the proxy answers it itself, with an error such as 403 Forbidden. It can also log who asked for what.
  5. Step 5: Caching. A proxy can keep copies of what it fetches. The first request for logo.png goes out to the server and the reply is stored. The next client to ask gets the stored copy straight from the proxy, faster, and the server is not contacted at all. Copies are kept only for as long as the server allows.
  6. Step 6: Reverse proxy: the mirror. A reverse proxy is the same idea facing the other way. It stands in front of servers, is set up by the site owner, and hides which server answered; clients do not know it is there. A load balancer is one kind. A forward proxy hides the clients; a reverse proxy hides the servers.
  7. Step 7: A VPN is a different tool. A VPN also hides the client’s address, but works lower down. A proxy handles the web requests of the one application set to use it, and need not encrypt anything. A VPN takes all of the device’s traffic, from every application, and carries it through an encrypted tunnel to the VPN server.
VALUES SO FAR
client192.0.2.23address
proxy····address
logged····by server
side····position
blocked····filter
cache····result
reverse····contrast
VPN····contrast

Spotted a mistake on this page?