Reverse Proxy Commands
Set up Nginx reverse proxy to backend applications, implement load balancing strategies, configure upstream health checks, and enable WebSocket proxying for real-time applications.
10 commands
Pro Tips
Always set proxy headers: `proxy_set_header Host $host;` and `proxy_set_header X-Real-IP $remote_addr;` for backend visibility.
Use upstream blocks with multiple servers for automatic load balancing and failover capabilities.
Enable WebSocket proxying with `proxy_http_version 1.1;` and `proxy_set_header Upgrade $http_upgrade;` directives.
Configure `proxy_buffering off;` for streaming responses like SSE or long-polling to avoid delays.
Common Mistakes
By default, Nginx buffers responses. This can cause issues with streaming or real-time applications - adjust buffer settings accordingly.
The trailing slash in `proxy_pass` matters: `proxy_pass http://backend/` behaves differently than `proxy_pass http://backend`.