Forward Proxy vs Reverse Proxy
Overview
A proxy is a middleman: it receives a request from one side, passes it to the other, and relays the answer back. Where you put the middleman decides what it does. This lesson separates the two basic kinds, forward and reverse, which are easy to confuse.
Detailed Notes
What is a proxy
A proxy is an intermediary server that accepts requests from one party, forwards them to another, and relays the responses back.
There are two kinds:
- A forward proxy sits in front of clients and makes requests to the internet on their behalf.
- A reverse proxy sits in front of servers and receives requests from clients on their behalf.
Memory trick: a forward proxy protects users; a reverse proxy protects servers.
The problem it solves
Direct connections between clients and servers leave nobody in control. A company cannot filter or log what employees visit. A website exposes the address and number of its servers, and each server must handle its own security. A middleman gives you one control point to inspect, change, secure or route traffic.
How it works
Forward proxy. Clients are configured (or forced by the network) to send traffic through it.
- Flow: client -> forward proxy -> internet server -> forward proxy -> client.
- It hides the client's identity: the website sees the proxy's IP address, not the employee's.
- Typical jobs: content filtering, access control, logging, controlling outbound traffic from servers in locked-down networks.
- For encrypted (HTTPS) sites it usually creates a tunnel with the HTTP CONNECT method, passing the encrypted data along without reading it.
Reverse proxy. Clients do not know it exists; they think it is the real server.
- Flow: client -> reverse proxy -> one of many backend servers -> reverse proxy -> client.
- It hides the servers' identity, count and internal layout.
- Typical jobs: TLS termination, routing by URL, compression, security checks, and spreading traffic across servers. Load balancing, caching, rate limiting and gateways are all covered in later chapters; most are really specialised reverse proxies.
TLS termination means the proxy performs the encryption handshake with the client and decrypts the traffic, so certificates live in one place and the backends do less work.
| Forward proxy | Reverse proxy | |
|---|---|---|
| Acts on behalf of | Clients | Servers |
| Client knows about it? | Yes, or it is forced | No, looks like the real server |
| Hides | Who the client is | What the servers are |
| Main goals | Control, filtering, privacy | Scale, security, routing |
| Usually owned by | The client's organisation | The service owner |
One catch: backends see the proxy's IP as the caller. A reverse proxy passes the real client IP in an HTTP header such as X-Forwarded-For, and backends should trust that header only from their own proxies.
Costs: an extra network hop (a little latency), another component to run, and if there is only one proxy it is a single point of failure, so you run several. A proxy that decrypts traffic can also read it, so it must be trusted.
A simple example
A forward proxy is like a company receptionist who makes all outgoing calls for employees: outsiders only see the company switchboard number. A reverse proxy is like a front desk in a big office building: visitors ask for "the shop", and the desk decides which room to send them to, without revealing the building's layout.
System design example
A bank puts a cluster of reverse proxies in front of its online banking app. Customers connect to the proxies, which terminate TLS, block bad requests and route each request to the right backend service by URL path (/api, /static, and so on). Inside the bank, employees reach the internet only through a forward proxy that blocks malicious sites and logs access. The two proxies protect opposite sides.
Summary
- A proxy is a middleman server relaying requests and responses.
- Forward proxy: in front of clients; hides and controls the client.
- Reverse proxy: in front of servers; hides and protects the servers.
- Reverse proxies do TLS termination, routing and more; pass the client IP via headers.
- Cost: an extra hop and a possible single point of failure, so run several.
Architecture Diagram
A forward proxy fronts clients; a reverse proxy fronts servers.
- 1Clients send traffic through an optional forward proxy that applies company policy.
- 2Requests cross the internet to the service's public address.
- 3The reverse proxy terminates TLS and checks the request.
- 4It routes the request to an app server and relays the response.
Common Interview Questions
Finished this lesson?
0 of 91 lessons done · 0% of the course

