A reverse proxy is a server that sits in front of one or more web servers, receives every request from clients, forwards it to the right backend server and returns that server's response as if it came from the proxy itself. The HTTP standard calls it a gateway. Reverse proxies handle load balancing, TLS termination, caching and security.
| Reverse proxy at a glance | |
|---|---|
| Sits in front of | Web and application servers |
| Works for | The website or API owner |
| What visitors see | The proxy's address, not the backend server's |
| Common jobs | Load balancing, TLS termination, caching, compression, attack filtering |
| Common software | NGINX, Apache HTTP Server, HAProxy, Caddy, CDNs |
How does a reverse proxy work?
A reverse proxy works by taking the public address of a website, so every request reaches the proxy first and never touches the backend directly.
- A visitor's browser looks up the site's domain and connects to the reverse proxy's IP address.
- The reverse proxy reads the request and picks a backend server using its rules, such as the path, the hostname or the current load.
- The reverse proxy opens its own connection to that server and forwards the request, often adding a header such as X-Forwarded-For with the visitor's IP address.
- The backend server sends its response to the reverse proxy.
- The reverse proxy returns the response to the visitor, sometimes compressing or caching it first.
The HTTP standard, RFC 9110 (June 2022), names this role a "gateway" (also known as a reverse proxy): an intermediary that acts as the origin server for the outbound connection. Proxies on both sides can add a Via header to record the hops a message passed through.
What is a reverse proxy used for?
A reverse proxy is used to make a website faster, safer and easier to scale without changing the application behind it. The NGINX documentation lists these jobs:
- Load balancing: the reverse proxy spreads requests across several backend servers and stops sending traffic to one that fails, as our guide to reverse proxy vs load balancer explains.
- TLS termination: the reverse proxy decrypts HTTPS, so backend servers skip that work.
- Caching: the reverse proxy stores responses and answers repeat requests without asking the backend, the same job a caching proxy does.
- Compression: the reverse proxy shrinks responses, for example with gzip, to save bandwidth.
- Security: the reverse proxy hides backend addresses and can limit connections or deny IP addresses during an attack.
What is the difference between a reverse proxy and a forward proxy?
A reverse proxy works for the website and sits in front of servers, while a forward proxy works for the user and sits in front of clients. RFC 9110 describes a forward proxy as an agent chosen by the client, usually through local settings. A reverse proxy is chosen by the website owner, and visitors rarely know it's there.
| Reverse proxy | Forward proxy | |
|---|---|---|
| Deployed by | Website or API owner | User, company or scraping team |
| Sits in front of | Servers | Clients |
| Hides | Backend server addresses | The client's IP address |
| Typical uses | Load balancing, TLS, caching, attack filtering | Privacy, location testing, web scraping, content filtering |
| Examples | NGINX, HAProxy, CDNs | Residential proxies, datacenter proxies, corporate web proxies |
Both are types of proxy server. Our guide to forward proxies vs reverse proxies compares them in more depth, and client-side types such as the transparent proxy and the HTTP proxy have their own guides.
Which software can act as a reverse proxy?
Most web servers and load balancers can act as a reverse proxy, and teams usually pick the one they already run.
- NGINX: a web server that becomes a reverse proxy with the proxy_pass directive.
- Apache HTTP Server: a web server that proxies requests through its mod_proxy module.
- HAProxy: a dedicated TCP and HTTP load balancer and reverse proxy.
- Caddy: a web server with a built-in reverse_proxy directive.
- CDNs: networks that run reverse proxies in many locations close to visitors.
How do you set up a reverse proxy with NGINX?
You set up a reverse proxy with NGINX by adding a server block whose location passes requests to the backend with proxy_pass. This minimal config sends traffic for example.com to an app on port 3000 and passes the visitor's IP address along:
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-Forwarded-For $proxy_add_x_forwarded_for;
}
}This config was tested with NGINX 1.24.0 in November 2026: the app behind it received the original Host header and the client's IP address in X-Forwarded-For. Run nginx -t to check the syntax, then sudo nginx -s reload to apply it.
Why do reverse proxies matter for web scraping?
Reverse proxies matter for web scraping because the server a scraper talks to is often a reverse proxy, not the website's application. Many large sites sit behind a CDN or a bot-protection reverse proxy that checks request rates, IP reputation and browser fingerprints before a request reaches the backend. When a scraper gets blocked, the reverse proxy usually made that decision.
That's why scraping teams run forward proxies on their own side. Spreading requests across many IP addresses keeps each address under the reverse proxy's rate limits. Rotating proxies change the IP address on every request, and residential proxies use IP addresses from home connections that look like ordinary visitors.