-
-
Save Bubelbub/0a942a0d51a3d329897d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream backend { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80; | |
access_log /var/log/nginx/yoursite.access.log; | |
error_log /var/log/nginx/yoursite.error.log; | |
server_name api.yoursite.com | |
# prevents 502 bad gateway error | |
large_client_header_buffers 8 32k; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
# prevents 502 bad gateway error | |
proxy_buffers 8 32k; | |
proxy_buffer_size 64k; | |
proxy_pass http://backend; | |
proxy_redirect off; | |
# enables WS support | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
I had commented this line
proxy_set_header Connection "upgrade";
uncommented it and it worked. Thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I still get randomly 502 errors with this config