-
Notifications
You must be signed in to change notification settings - Fork 31
Websocket handshake error #170
Comments
Thanks for reporting @nicofrand |
I am not sure it is socket.io related… Maybe that comes from Apache ? Is there anyone using nginx that can reproduce the error ? Does cozy configure nginx like this socketio/socket.io#1942 (comment) ? |
@thierrymarianne you posted a solution here, did you remove it ? Why ? The solution was to enable a2enmod proxy_wstunnel module: a2enmod proxy_wstunnel And then add this into the apache VirtualHost configuration before the RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:9104/$1 [P,L] It seems to work for me. However there are 2 things:
If we wanted to make it more global maybe we could use a RewriteCond like this: RewriteCond ^(apps\/\w*\/)?socket.io(.*) Once those questions answered, that might be a good thing to add to cozy-debian apache-conf ? (ping @nledez) |
@nicofrand It didn't seem to solve the issue entirely. I keep seeing the transport parameter switching back to polling. |
I think I solved it, the following rules should cover most of the cases (with socket.io I mean): RewriteEngine On
RewriteCond %{REQUEST_URI} ^/.*socket\.io [NC]
RewriteCond %{THE_REQUEST} websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:9104/$1 [P,L] You will also need to enable proxy_wstunnel and mod_rewrite modules:
|
Hi @thierrymarianne, would you mind testing the solution above please, if you have time ? If that works for you, maybe I could create a ticket on cozy-debian (or try a PR) and update the documentation… |
@nicofrand Sure thing, I'll let you know ASAP :) |
@nicofrand Unfortunately, I can not confirm the configuration above works for me. First, I thought it did before noticing |
Cool. Le mer. 18 nov. 2015 20:52, Thierry Marianne [email protected] a
|
Keeping any of the following sets of rules seems to prevent the
or
However, it fails with The host resolution was a mistake on my end. |
@nicofrand I have the socket transport mode working with the following rules for both basic apps requests (calendar, contacts, emails, files and photos) and the root path request:
It might be considered as a an alternative to match requests using %{THE_REQUEST} server variable with apache (which use didn't work out for me with Apache/2.4.10). P.S.
|
I used %{THE_REQUEST} because some apps are not using the query string to specify the websocket transport. For example with Term :
I do not see why that would not work for you :(. |
@nicofrand I might have been too caffeinated yesterday (or the exact opposite might be true) as your original set of rules perfectly works as is for me today though I could not get Term installed to double-check with it. Sorry for the confusion. |
@nicofrand The devil was in the details but I nailed it eventually: RewriteEngine On
RewriteCond %{REQUEST_URI} ^/.*socket\.io [NC]
RewriteCond %{THE_REQUEST} websocket [NC]
-RewriteRule (.*) ws://127.0.0.1:9104/$1 [P,L]
+RewriteRule /(.*) ws://127.0.0.1:9104/$1 [P,L] |
Oops, that 's what I have too on my server, I guess I forgot it here, I'll edit my post… |
@nicofrand I figured Term requires manual installation of |
Cool, I'll see for the documentation and the cozy-debian package then. |
I would like to thank all of you for the awesome job you did in fixing and documenting this !!! Cozy community rox ! |
@clochix Thank you for having provided us with great foundations for applications self-hosting :) |
I regularly meet this error in my browser console after refreshing the page:
WebSocket connection to 'wss://***/public/files/socket.io/?EIO=3&transport=websocket&sid=DGvqewDGc_GvZX-3AAAB' failed: Error during WebSocket handshake: Unexpected response code: 400
This does not seem to impact the applications though.
Here are my proxy logs after refreshing the page for the photos app:
The text was updated successfully, but these errors were encountered: