Question: What could be the possible reasons for socket-io server returning 400 Bad Request via nginx?
See original GitHub issueHi,
We are facing a scenario where a good percentage of requests going to /Socket.io/?...
is returning with 400.
Default nginx access log results are littered with:
10.0.0.82 - - [04/Dec/2015:11:43:27 +0000] "GET /socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket HTTP/1.1" 400 45 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"
The requests are not even reaching our overlying SailsJS server. We suspect something going wrong at socket-io layer. Any thought?
Issue Analytics
- State:
- Created 8 years ago
- Comments:29 (3 by maintainers)
Top Results From Across the Web
nginx as webserver incl. socket.io and node.js / ws:// 400 Bad ...
The problem is that ws:// doesnt work. If the system using xhr polling i could use ajax requests to background server instead using...
Read more >Socket.io call throwing 400 Bad Request for some users
I'll urge to you check your Nginx Error Logs, the error will most certainly be logged there. Once it's logged there it will...
Read more >"Bad Request" when sending request to Socket.IO app via ...
The answer turned out to be very prosaic. As it turned out, the front-end had version 2 of Socket.IO , and on the...
Read more >Troubleshooting connection issues | Socket.IO
Possible explanations : a proxy in front of your servers does not accept the WebSocket connection.
Read more >400 Bad Request - SSL Certificate Error | Apigee Edge
During the TLS handshake if it is found that the client certificate is expired, then the server will send 400 - Bad request...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After a LOT of painstaking log-watching, this is our temporary solution for nginx config (to stop freaking out our servers.) The following directive checks for missing “Upgrade” header in request and returns with a
202
without hitting the node server.Now, this does NOT fix the clients that are sending these requests, but surely frees up the server. Now, the question is @rauchg, why are some socket.io clients not sending the “upgrade” header? One pattern is that they are all Windows and a very few Linux machines. Did not spot a single OSX in one full hour of heavy usage.
I will then have to deep dive into socket.io - it’s being returned by socket.io with no additional message -
{ code: 3, message: “badRequest”}