I think I almost out of idea. Been trying all solution on other answer and all blogpost, but still out of luck.
Here's what I'm trying to do. I have nodejs server with socket.io running in certain port and want proxy pass from the port 80 with the nginx. The condition is my app still work, and successfully sent the request via socket.io and the other client received it. But the thing is I keep getting "Upstream timed out" error, and there is a lot of them.
This is my current nginx setting after a lot changes:
upstream node_server.com {
server 127.0.0.1:3002 max_fails=0 fail_timeout=10s;
keepalive 512;
}
server {
listen 443;
client_max_body_size 16M;
keepalive_timeout 10;
ssl on;
ssl_certificate my.crt;
ssl_certificate_key my.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
server_name my_domain.com;
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;
proxy_buffers 8 32k;
proxy_buffer_size 64k;
proxy_pass https://node_server.com;
proxy_redirect off;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
tcp_nodelay on; # not necessary
}
}
And this is the error message I got (there's a lot of them):
[error] 8131#0: *4599 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 112.215.64.131, server: my_domain.com, request: "GET /socket.io/?EIO=3&sid=ZRsV9eAnEItl90-vAH-j&transport=polling&user=2104655266f3db0f2a HTTP/1.1", upstream: "https://127.0.0.1:3002/socket.io/?EIO=3&sid=ZRsV9eAnEItl90-vAH-j&transport=polling&user=2104655266f3db0f2a", host: "my_domain.com"
Even tough my app still work right now, I want to get rid all of the error. Really appreciate any help.