Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Glossary

Reverse proxy: a server in front of your servers

A reverse proxy is a server that receives client requests, forwards them to one or more backend servers and returns the response to the client. It is commonly used to spread load, hide backend servers and hand requests to application servers.

The short answer
  • Clients talk to the proxy. The proxy talks to the backend.
  • Common jobs: load balancing, caching, TLS termination and filtering.
  • The backend sees the proxy address unless you pass the client IP in a header.

What does a reverse proxy config look like?

nginx: forward /app/ to a local application server
location /app/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:8000;
}

What do reverse proxies do?

Load balancing

Requests can be spread across a named group of servers using a load-balancing method.

Non-HTTP backends

nginx can pass requests to FastCGI, uwsgi, SCGI and memcached servers with dedicated directives.

TLS termination

The proxy holds the certificate and talks plain HTTP to backends on a private network.

Caching and CDN

A CDN edge works as a reverse proxy with a cache, in front of your origin.

Filtering

A WAF is often deployed as a reverse proxy to inspect HTTP traffic before it reaches the app.

Header control

The proxy can set or remove headers, such as Host and X-Real-IP, before forwarding.

Source of many 502 and 504 errors

When the proxy cannot get a valid or timely answer from the backend, it returns 502 or 504. These errors point at the layer behind the proxy, so check the application process first.

Common questions

What is the difference between a forward proxy and a reverse proxy?

A forward proxy sits in front of clients and makes requests on their behalf, for example a corporate proxy. A reverse proxy sits in front of servers and receives requests on their behalf. Clients usually do not know a reverse proxy is there.

Is nginx a reverse proxy?

Yes. nginx documents proxying as a core use: it receives a request, forwards it to a specified server, fetches the response and returns it to the client. It is commonly used to spread load, show content from other sites or pass requests to application servers.

Why does my application see the wrong client IP behind a proxy?

The backend sees the connection from the proxy. Pass the original address in a header, for example nginx proxy_set_header X-Real-IP $remote_addr, and make the application read that header, trusting it only from your own proxy.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.