A reverse proxy terminates client connections and forwards requests to application servers. proxy_pass defines the upstream URL; a trailing slash alters URI rewriting. Tune proxy_buffering for large downloads versus streaming responses. WebSockets need Upgrade and Connection headers. Behind another proxy or CDN, restore the client IP with real_ip only for trusted networks.
| Scenario | Directive | Pitfall |
|---|---|---|
| Strip or keep URI prefix | proxy_pass with or without trailing / | Unexpected path rewriting |
| SSE or long poll | proxy_buffering off | Higher memory if misapplied globally |
| Client IP for logs | set_real_ip_from | Spoofing if trusts are too wide |
Related
X-Forwarded-For, nginx SSL, nginx configuration, performance tuning