What is a reverse proxy and how does it differ from a regular proxy
What a reverse proxy is, how it differs from a forward proxy, what Nginx, Cloudflare and load balancers do, and with a simple Nginx example.
A reverse proxy is a server that stands in front of websites and accepts requests from visitors on their behalf. The visitor thinks they are talking to the website, but in fact they are talking to the reverse proxy, which passes the request to the real server behind it.
Forward proxy vs reverse proxy
- A forward proxy (a regular proxy) works for the client: it hides the user's IP from websites. This is what you buy to manage accounts, scrape data or change your country. More in “What is a proxy server”.
- A reverse proxy works for the server: it hides the website's real servers from visitors.
| Forward proxy | Reverse proxy | |
|---|---|---|
| Who sets it up | The user | The website owner |
| Whom it hides | The client | The server |
| Examples | Proxies for browsers, Telegram, scrapers | Nginx, HAProxy, Cloudflare, Traefik |
What a reverse proxy is used for
- Load balancing — spreading requests across several servers.
- Protection — hiding the server's IP, filtering attacks and bots (WAF).
- HTTPS termination — certificates are handled in one place.
- Caching and compression — static files are served faster.
- One entry point for several services:
/apigoes to one server,/to another.
Simple Nginx example
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Nginx accepts requests on port 80 and passes them to the app on port 3000. The X-Forwarded-For header keeps the visitor's real IP for the app.
Cloudflare as a reverse proxy
When a website uses Cloudflare, visitors connect to Cloudflare's servers, and Cloudflare connects to the website. That is why Cloudflare errors such as 522 or 502 mean a problem between Cloudflare and the website's server. See “Errors 403, 429, 502 and 522”.
Why it matters when you use proxies
Most big websites sit behind reverse proxies with anti-bot protection. They look at the reputation of your IP, the request rate and the browser fingerprint. A private, clean IP and a reasonable request rate get through such protection much more easily.
ProxyZen sells forward proxies: private IPv4 from $0.60 for 3 days, residential and mobile by traffic. Buy proxies.
Try ProxyZen
Private IPv4 and IPv6 for 3 to 90 days, residential and mobile per GB. Instant delivery, HTTP(S) and SOCKS5.