upgrade to 0.6.x issue
-
Upgraded my 0.5.7 nodebb today to 0.6.x and getting this error always;
WebSocket connection to 'ws://www.koinyum.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 503
WebSocket connection to 'ws://www.koinyum.com/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
The error keeps triggering..
@update i'm also using apache.
-
I was having the same issue as OP with websockets, now I have this in console at ACP.
GET https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419539326381-93&sid=TEguvhP5GP2nhwDABM 400 (Bad Request) nodebb.min.js:12667 POST https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419539337195-94&sid=TEguvhP5GP2nhwDABM 400 (Bad Request)
Using apache, ssl, one instance of nodebb.
-
same with @priapo, didn't fixed for me.
v6 long polling doesn't work anymore · Issue #2554 · NodeBB/NodeBB
Used version: f403a29 Version which still works: da4014e The long polling just don't work anymore. NodeBB is now trying the whole time to connect to the websockets and just don't try to fallback to longpolling. From Chrome Console: (195)...
GitHub (github.com)
-
Just a thought... what happens when you run
npm ls socket.io socket.io-client
?For me:
[email protected] /home/julian/Projects/nodebb/forum ├── [email protected] └── [email protected]
-
[email protected] /home/nodebb/nodebb ├── [email protected] └── [email protected]
As mentoined in the issue, the polling and so the transfer works but throws errors if you're idling and no data is transferred while the long polling request.
-
@julian said:
npm ls socket.io socket.io-client
[email protected] /home/user/bbs ├── [email protected] └── [email protected]
-
I reinstalled both.. still getting the error... maybe is something with Apache proxy as @raistlinthewiz said he is also using it.
GET https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419631909437-6&sid=0GXmkhgSRxZlCDESAAAW 400 (Bad Request) nodebb.min.js:12667 POST https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419631920915-7&sid=0GXmkhgSRxZlCDESAAAW 400 (Bad Request) nodebb.min.js:12667 GET https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419631925604-14&sid=9ndsEWRLlGKLAhb5AAAX 400 (Bad Request) nodebb.min.js:12667 POST https://bbs.kassius.org/socket.io/?EIO=3&transport=polling&t=1419631937170-15&sid=9ndsEWRLlGKLAhb5AAAX 400 (Bad Request)
-
No nothing.. I tried installing nginx and used it with the first setup in here, no ssl: https://docs.nodebb.org/en/latest/configuring/proxies/nginx.html still the same. I created another chrome user because of the 301 redirects to https so no cache. Websockets dont work (loading icon stays) and polling throws errors, but at least works...
my config is
{ "url": "https://bbs.kassius.org", "port": "4454", "secret": "xxsecret", "bind_address": "127.0.0.1", "database": "redis", "redis": { "host": "127.0.0.1", "port": "4562", "password": "verylongredispass", "database": "0" }, "bcrypt_rounds": 12, "upload_path": "/public/uploads", "use_port": false, "socket.io": { "transports": ["polling","websocket"] } }
-
Now it is working for me, it was really something with the proxy on Apache 2.4 and socket.io1.0, I saw this topic:
And configured Apache like this:
Without SSL
https://gist.github.com/kassius/78c633a803d3c711b171
<VirtualHost *:80> ServerName forum.example.com # ServerAdmin webmaster@localhost <Proxy *> Require all granted </Proxy> ProxyRequests off ProxyVia on RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:4567/$1 [P,L] ProxyPass /socket.io http://localhost:4567/socket.io ProxyPassReverse /socket.io http://localhost:4567/socket.io <Location /> ProxyPass http://127.0.0.1:4567/ ProxyPassReverse http://127.0.0.1:4567/ </Location> ErrorLog /home/username/logs/apache/forum-error.log CustomLog /home/username/logs/apache/forum-access.log combined </VirtualHost>
With SSL, redirecting to HTTPS:
https://gist.github.com/kassius/954e0787d6893c5ab8e1
<VirtualHost *:80> ServerName forum.example.com Redirect permanent / https://forum.example.com </VirtualHost> <VirtualHost *:443> ServerName forum.example.com SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM SSLCertificateFile /etc/apache2/ssl/example-com/forum.ssl.crt SSLCertificateKeyFile /etc/apache2/ssl/example-com/private.key SSLCertificateChainFile /etc/apache2/ssl/example-com/sub.class1.server.ca.pem # ServerAdmin webmaster@localhost <Proxy *> Require all granted </Proxy> ProxyRequests off ProxyVia on RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:4567/$1 [P,L] ProxyPass /socket.io http://localhost:4567/socket.io ProxyPassReverse /socket.io http://localhost:4567/socket.io <Location /> ProxyPass http://127.0.0.1:4567/ ProxyPassReverse http://127.0.0.1:4567/ </Location> ErrorLog /home/username/logs/apache/forum-error.log CustomLog /home/username/logs/apache/forum-access.log combined </VirtualHost>
Now is working even with pure websockets like
"transports": ["websocket"]
.
It uses Apache's mod_rewrite module. -
The setting in config.json doesn't affect nodebb? I think it does, see I changed config.json between
"transports": ["websocket","polling"]
and"transports": ["polling","websocket"]
and saw by Chrome Inspector that with websocket as prefered method it doesn't uses polling.Using
"transports": ["polling","websocket"]
:Using
"transports": ["websocket","polling"]
:I see this https://github.com/NodeBB/NodeBB/commit/e0edb71a8ab2f23eaebf5c7557d5d1d19bb55baa
-
@julian said:
@priapo Keep in mind putting a
socket.io
section inconfig.json
doesn't do anythingWe had just talked about this configuration option short time ago in the issue
so obviously it does affect. But
"transports": ["polling","websocket"]
is now the Standard.@priapo if you can't use the websockets you can set also "transports": ["polling"], then you will only get the failures for the long polling request which throws errors.
I just tested by connecting directly without any proxy before NodeBB. The timeout disappears.
So one failure source is that the timeout is higher than what is allowed by the proxy e.g. cloudflare. So an option to adjust the timeout would be great!
The failure throwing which are left now are:
GET http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766084670-12&sid=U4674pe85Cyiv5fiAA0b 400 (Bad Request) nodebb.min.js?9604615c:9 POST http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766094756-13&sid=U4674pe85Cyiv5fiAA0b 400 (Bad Request) nodebb.min.js?9604615c:9 GET http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766096635-23&sid=8hFwdN-s5JA2NQQdAA0d 400 (Bad Request) nodebb.min.js?9604615c:9 POST http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766106720-24&sid=8hFwdN-s5JA2NQQdAA0d 400 (Bad Request) nodebb.min.js?9604615c:9 GET http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766108697-34&sid=N9btkX1jyZnnsbfPAA0f 400 (Bad Request) nodebb.min.js?9604615c:9 POST http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766118775-35&sid=N9btkX1jyZnnsbfPAA0f 400 (Bad Request) nodebb.min.js?9604615c:9 GET http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766120692-45&sid=HL2WrppvFQVLUZZcAA0h 400 (Bad Request) nodebb.min.js?9604615c:9 POST http://localhost:4567/socket.io/?EIO=3&transport=polling&t=1419766130783-46&sid=HL2WrppvFQVLUZZcAA0h 400 (Bad Request)