3

I have upgraded my node.js app to work with the latest socket.io module. However, now only Firefox can connect, Chrome and Safari give this error: Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'

Tim
  • 71
  • 1
  • 7
  • 1
    Which versions of Chrome / Safari. Also try complaining in #socket.io – Raynos Jul 04 '11 at 22:21
  • Google Chrome 12.0.742.112 / Safari 5.0.5 (6533.21.1) – Tim Jul 05 '11 at 21:16
  • I am also experiencing this problem, using node 0.4.5 and socket.io 0.7.6 on dotcloud. –  Jul 06 '11 at 20:58
  • Temporary solution is to disable native websockets and use xhr-polling instead. I asked in #socket.io, nobody seems to know whats up, its not a common problem. I get the problem even with the hello world example app. – Tim Jul 07 '11 at 13:47
  • I have the same problem on Heroku, but they are using Nginx and state that they only support HTTP 1.0 (http://devcenter.heroku.com/articles/http-routing) – Olivier Amblet Nov 06 '11 at 02:27

3 Answers3

3

Nginx is not compatible (out of the box) with HTTP 1.1, which is required for WebSockets. You will need to patch it (something I couldn't help you with, too much trouble) or you could use a node.js only stack.

I use node-http-proxy.

See also: Advantages of a reverse proxy in front of Node.JS

Community
  • 1
  • 1
1

Yep, it's totally nginx - I had everything working fine, changed some nonessential stuff and then it wouldn't work. It's only after reading this that I realised that I'd stopped entering the port in the URL and thus was falling under nginx's proxying. Added the port, worked immediately.

nick-brown
  • 31
  • 2
  • 8
0

Check your Nginx version. v1.4 seems to work fine, whereas I had trouble with v1.2 (and had to upgrade).

  • FYI, if upgrading to 1.4 on Ubuntu, this is the resource you need: http://www.slashgeek.net/2013/05/08/how-to-get-the-latest-nginx-on-ubuntu-12-04-2-lts-precise-pangolin/ – Pete Romano Aug 22 '13 at 17:26