Nginx Reverse Proxy Configuration

A reverse proxy sits in front of your application servers and forwards client requests to them. Nginx is one of the most popular choices for this role — use our generator to build a correct, hardened config without writing a single line by hand.

The minimum that works

Pass requests to the backend and forward the original host and client address, otherwise the app sees every request as coming from 127.0.0.1.

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;
    proxy_set_header X-Forwarded-Proto $scheme;
}

What a production config adds

TLS termination, sensible proxy timeouts, response buffering choices, security headers and rate limiting. The generator emits these together and scores the result so you can see which hardening is missing.

Open the Reverse proxy generator

Frequently asked questions

Why does my app see the wrong client IP behind Nginx?

Nginx does not forward the client address unless you set X-Real-IP or X-Forwarded-For, and the application has to be configured to trust that header from the proxy.

Should proxy_pass have a trailing slash?

With a URI part (a trailing slash counts) Nginx replaces the matched location prefix; without one it passes the original request URI unchanged. Mixing them up is a common source of 404s.

Guides