6

I'm currently having a lots of difficulties trying to play with socket.io which needs websockets support from the server (reverse-proxying).

I was wondering, is there any other web servers out there that supports websockets?

The errors I'm having with nginx:

2012/05/22 02:19:34 [error] 28159#0: *5 connect() failed (111: Connection refused) while connecting to upstream, 
client: my.ip.ad.dr,
server: localhost,
request: "GET /socket.io/1/?t=1337653158192 HTTP/1.1", 
upstream: "http://127.0.0.1:3000/socket.io/1/?t=1337653158192", 
host: "lifestore.brainpad.org", referrer: "http://mywebad.dr/"
HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
Tommy B.
  • 1,413
  • 2
  • 14
  • 14
  • 2
    Websockets are not currently supported by Nginx (even though v1.2 implements HTTP/1.1) They are on the [roadmap](http://trac.nginx.org/nginx/roadmap) for Nginx 1.3. You may have some luck with the [tcp-proxy-module](https://github.com/yaoweibin/nginx_tcp_proxy_module) or [node-http-proxy](https://github.com/nodejitsu/node-http-proxy). Personally, I place Varnish in front of Nginx and have it proxy Websocket requests directly to Node.js (HAProxy should also work). – cyberx86 May 22 '12 at 04:08

2 Answers2

4

nginx doesn't natively support websockets. Looks like there is a tcp proxy module that can be compiled into nginx to do this.

http://www.letseehere.com/reverse-proxy-web-sockets

But a few other discussions(here and on SO) seem to indicate that one would go down to node.js directly.

Given that you're using socket.io, I suspect you're already using node.js on the backend. Also, this blog post by the trello team is rather informative. http://blog.fogcreek.com/the-trello-tech-stack/

kashyap
  • 196
  • 5
2

nginx has support for proxying WebSockets since version 1.3.13.

The only thing I've found so far that could conceivably be called documentation is this commit message.

tobbez
  • 121
  • 1