What is the difference between a forward proxy and a reverse proxy?
BeginnerConceptNetworking basics for DevOps
Answer
In one line: 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 the internet on their behalf.
Forward proxy (client side)
Users ──> Forward proxy ──> Internet websites
- The client knows it's using the proxy; the website sees the proxy's IP, not the user's.
- Uses:
- Corporate internet access control and filtering.
- Caching common downloads.
- Controlling outbound traffic from servers (an egress proxy, so servers can only reach approved sites).
- Privacy (hiding client IPs).
- Examples: Squid, corporate proxies; build agents often use
HTTP_PROXY/HTTPS_PROXYsettings.
Reverse proxy (server side)
Internet users ──> Reverse proxy ──> Backend servers
- The client usually doesn't know there are multiple servers behind it.
- Uses:
- Load balancing across backends.
- TLS termination (handles HTTPS certificates).
- Routing —
/apito one service,/to another. - Caching and compression.
- Security — hides backend servers, adds WAF rules, rate limiting.
- Examples: Nginx, HAProxy, Envoy, Traefik, AWS ALB, Azure Application Gateway, Cloudflare, Kubernetes Ingress controllers.
Example Nginx reverse proxy:
server {
listen 443 ssl;
server_name shop.example.com;
location /api/ { proxy_pass http://api_backend; }
location / { proxy_pass http://frontend; }
}
| Forward proxy | Reverse proxy | |
|---|---|---|
| Sits in front of | Clients | Servers |
| Acts on behalf of | The user | The website/service |
| Typical use | Filtering, egress control | Load balancing, TLS, routing |
Tip for interviews: use a simple sentence: "forward proxy protects and controls clients; reverse proxy protects and scales servers" — then give Nginx or an Ingress controller as an example.
More on Networking basics for DevOps
What happens when you type a URL in the browser and press Enter?BeginnerWhat is DNS, and what are common DNS record types?BeginnerWhat is the difference between TCP and UDP?BeginnerWhat are ports, and which common ports should a DevOps engineer know?BeginnerWhat is a CDN, and how does it help applications?BeginnerWhat are VPCs, subnets and security groups?Beginner