How to use nodebb websocket with cdn which doesn't support websocket?



  • Hello, I'm using nodeBB to host a forum on https://www.heigoule.com, I really like nodebb for its simplicity and extensibility.

    My site met a bug
    WebSocket connection to 'wss://www.heigoule.com/socket.io/?EIO=3&transport=websocket&sid=ziovHZJFdHWmdYmkAAAD' failed: Error during WebSocket handshake: Unexpected response code: 400
    Then I found that it was caused by my CDN service, they won't support websocket. The site worked perfectly before using cdn, so it's not a problem of my nginx configuration.

    The question is what should I do to make nodebb use another subdomain for websocket which I will disable websocket for?

    Thanks for your help!


  • Community Rep

    You could just turn websockets to polling mode only, in your config.json file.

    It should look something like this:

    {
    ...
      "socket.io": {
        "transports": ["polling"]
      },
    ...
    }
    

    Performance for your users should remain mostly the same.



  • Thank you for this solution, it works like a charm.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.