Proxying Websocket connections fails with "Connection closed before receiving a handshake response"
See original GitHub issueI use BrowserSync configured with the proxy setting to redirect all requests to my local webserver.
When opening the page, i get the following error message in Chrome (Version 42, Arch Linux):
WebSocket connection to 'ws://localhost:3000/ws/791/ori74537/websocket' failed:
Connection closed before receiving a handshake response
Due to this issue in the foxy project, there was indeed no working support for proxying websocket connections: https://github.com/shakyShane/foxy/issues/2
But they pushed a fix in release 10.1.2 which is included as dependency in the current BrowserSync release 2.7.1. I tried using that version, but it did not change anything and i still get the same error.
Do you need more information? Can anyone confirm this issue?
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Socket.io - failed: Connection closed before receiving a ...
I set up the server on http://jmi.io:3000. As you can see, it works fine with a beautiful long polling channel but now try...
Read more >WebSocket Connection closed before receiving a handshake ...
I have configured BIMServer to response back to my application and render 3D view loading individual component on viewer(pop-up window). I am ...
Read more >Proxying Websocket connections fails with ... - GitHub
The solution is to simple boot a separate server to handle Browsersync's websocket connections when in proxy mode and pass through all of...
Read more >Connection closed before receiving a handshake response
Best Answer. Not sure if this meets your problem completely. But the WebSocket Connection error can be resolved by using the ReconnectingWebSocket script...
Read more >WebSocket connection to ws:// failed - Google Groups
YES - its the Proxy server failing i just tested directly to the main SIP server and it worked 10 times but 10...
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
Bit late to the party here, but could I grab an example of the proxy through browsersync by any chance?
Ok, so I have this all fixed now - I need to test in more envs, but I’m pretty sure it’s good to go.
For anyone interested - the problem was relating to the fact that Browsersync in proxy mode tries to use a single server/port to serve the client script, run the web sockets + proxy requests through to your server.
Well it turns out that of course socket.io is handling the
upgrade
event on the server for Browsersync’s websockets - which means that it was simply not possible to also allow the proxy to pass through other websockets upgrades (for example, your app’s chatroom or whatevs).The solution is to simple boot a separate server to handle Browsersync’s websocket connections when in proxy mode and pass through all of your own websockets via the proxy (as you’d expect).