A reverse proxy sits at the entrance to a website or API. To the client it looks like the service itself, but it generates nothing: it forwards requests to internal servers and returns their responses. A typical example is nginx in front of an application backend, which accepts HTTPS, serves static files and sends other requests to the application.
How it differs from a forward proxy
A forward proxy works on the client side: a user or network admin configures it, and servers see only the proxy, not the individual computers behind it. A reverse proxy works on the service owner’s side: clients don’t know which internal server will handle their request.
| Question | Forward proxy | Reverse proxy |
|---|---|---|
| Whose side | the client or corporate network | the server owner |
| Who it hides | clients from servers | servers from clients |
| Who configures it | a user or network admin | the site or service admin |
| Example | a corporate gateway to the internet | nginx at the entrance to a web application |
What it does
- Terminates TLS: holds the certificate and the HTTPS connection with the client, and passes requests inside over plain HTTP or a secure channel.
- Distributes requests among several identical servers using load-balancing algorithms.
- Caches responses and serves repeated requests without contacting the backend.
- Serves static files directly, sparing the application.
- Limits request rates and, together with a WAF, filters out obviously malicious traffic.
- Compresses responses and adds caching headers.
Example: nginx
A minimal configuration: nginx accepts requests to the site and passes them to the application on a local port.
server { listen 443 ssl; server_name example.uz; ssl_certificate /etc/ssl/example.uz.crt; ssl_certificate_key /etc/ssl/example.uz.key; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } nginx holds the HTTPS connection with the client, while the application receives the request over HTTP on port 8000. The X-Forwarded-For header tells the application the client’s real address; otherwise it would see only the proxy’s address.
Sources
the term is written from these pagesVerified 9 Nov