upgrade to 0.6.x issue

General Discussion
  • 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.

  • 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]
    
  • Are you also up to date with vanilla and lavender? This could be caused by the loading of an old library (v0.9.x) instead of the newest (v1.0.0).

    @priapo I can't access your NodeBB right now to check.

  • 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)
    
  • @priapo Caching layer in front of the web server? (varnish etc)

    Possibly browser cache?

  • 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 [email protected]
     
    	<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 [email protected]
     
    	<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.

  • @priapo Keep in mind putting a socket.io section in config.json doesn't do anything 😄

    Edit: I stand corrected 😄

  • 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"]:

    polling

    Using "transports": ["websocket","polling"]:

    websocket

    I see this https://github.com/NodeBB/NodeBB/commit/e0edb71a8ab2f23eaebf5c7557d5d1d19bb55baa

  • @julian said:

    @priapo Keep in mind putting a socket.io section in config.json doesn't do anything 😄

    We 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)
    


Suggested Topics