Skip to content

Reverse Proxy

In one line

A reverse proxy is a server that receives client requests and forwards them to backend servers, then returns the response.

In simple words

A reverse proxy is a server that sits between clients and your backend servers. Clients send requests to the proxy, and the proxy forwards them to the appropriate backend server, then returns the response.

Unlike a forward proxy (which sits between clients and the internet, used for anonymity), a reverse proxy sits in front of your servers. Common reverse proxies include nginx, HAProxy, and Traefik.

Reverse proxies provide several benefits: load balancing (distributing traffic), TLS termination (handling HTTPS so backends don't have to), caching (serving cached responses), compression, and routing (directing requests to different services based on path or host).

Example

nginx
server {
    listen 80;
    server_name example.com;

    location /api/ {
        proxy_pass http://api-server:3000/;
    }

    location / {
        proxy_pass http://web-server:80/;
    }
}

This nginx config routes /api/ requests to the API server and everything else to the web server.

How it works

  1. A client sends a request to the reverse proxy.
  2. The proxy decides which backend server should handle it.
  3. It forwards the request to that backend.
  4. The backend returns the response to the proxy, which returns it to the client.

Common confusions

  • Confused with: Forward Proxy

    The difference: A reverse proxy sits in front of servers and handles incoming traffic; a forward proxy sits in front of clients and handles outgoing traffic.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary