Nginx randomly dropping connections #955
Closed
testnetprotonmail
started this conversation in
General
Replies: 2 comments
-
I believe you need to let nginx know how to proxy certain headers, example setup could be like: http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server 192.168.100.10:8010;
}
server {
listen 8020;
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
}
} Reference: https://www.nginx.com/blog/websocket-nginx/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Disabling ipv6 on the host fixed it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I believe nginx is randomly dropping connections. It seems very random but roughly 50% of the time my requests for opening a socket never make it to the nodeJS instance, (I log the req in the upgradeHandler as a means to verify if it was received)
Every time this happens a log is created in error.log of nginx:
connect() failed (111: Unknown error) while connecting to upstream,
Which seems to indicate the error lies with the uWebsockets.js instance, and there my trail ends as my uWebsockets.js app never seems to be relayed the request.
& then my nginx right now is just
I've tried many different nginx configurations, all kinds of headers, but couldn't figure it out.
I've switched from a different socket library with the same nginx configurations and never had this.
Is there perhaps any way to attain additional logs from the Uwebsockets app (maybe there is something to log before the upgrade handler that would clue me in on the solution?
Beta Was this translation helpful? Give feedback.
All reactions