WebSocket error in console..
-
Hello,
I just noticed that i am getting the following websocket error in the chrome console:
nodebb.min.js:5 WebSocket connection to 'ws://mydomain.com/socket.io/?EIO=3&transport=websocket&sid=bNvLK8Xh-fCr0hErAAAj' failed: Error during WebSocket handshake: Unexpected response code: 400
I am using apache 2.4 to redirect traffic to the nodebb port:
My Apache config is:
ProxyPass /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocket
ProxyPassReverse /socket.io/1/websocket ws://127.0.0.1:4567/socket.io/1/websocketProxyPass /socket.io/ http://127.0.0.1:4567/socket.io/
ProxyPassReverse /socket.io/ http://127.0.0.1:4567/socket.io/ProxyPass / http://127.0.0.1:4567/
ProxyPassReverse / http://127.0.0.1:4567/Anyone know why i am getting the error?
Thanks,
-
I'm on apache 2.4.7 this works for me after trying different things for a long time
RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:4567/$1 [P,L] ProxyPass / http://localhost:4567/ ProxyPassReverse / http://localhost:4567
should be probably updated in the official documentation
-
Hi,
I still have problem configurating apache...
With the new configuration (using the RewriteEngine) I get a 404 error instead of the 400.Here a line from the access_log
[11/Mar/2016:13:25:03 +0100] "GET /ws://127.0.0.1:4567/socket.io/?EIO=3&transport=websocket&sid=Wo9q_vZG6QCSZ7-9AAFN HTTP/1.0" 404 4815 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36"
Any ideas on this?
Thanks -
@julian Thanks for the answer
I'm using apache 2.2.22 and it seems like there is a bug in that version wich causes the leading slash. I'm upgrading to 2.4 next week hoping this solves the issue...
An other option is the"<If ...>"
directive, but thats only available in 2.4, too...