What proxy works with websockets?

508 views
Skip to first unread message

Nick Jennings

unread,
Jul 8, 2012, 6:34:13 PM7/8/12
to python-...@googlegroups.com
Hi All,

I know this isn't 100% related to tornado, but I figured someone
(many of you?) here has had to run into this

I want to run more than one websocket instance on a single server, I
*thought* I could do this with nginx, but realized late in the game
that it did not support websockets yet. So I'm forced to have the
client side (a flash app) connect directly to a port number of a
single instance. This obviously is not ideal, and although right now
we are still just in development, so it's not a huge problem, once we
want others to use this web-app we're going to have to deal with
firewall issues not to mention scaling due to not being able to proxy
over several instances / servers.

So is there any proxy out there that currently supports websockets?
What about someone like Amazon AWS? Do they have a proxy service which
supports it?

I'd like to avoid going back to Apache, since I would assume It's
going to effect performance. Likewise I heard there was some hack to
older versions of nginx to get it working, but I would like to avoid
that unless there are no other options.

Any words of advice from someone who's been through this would be very helpful.

Cheers
Nick

Alek Storm

unread,
Jul 8, 2012, 6:38:03 PM7/8/12
to python-...@googlegroups.com
Nginx definitely works with WebSocket - just install the tcp_proxy module. Instructions here: http://www.letseehere.com/reverse-proxy-web-sockets.

Alek

Didip Kerabat

unread,
Jul 8, 2012, 7:08:47 PM7/8/12
to python-...@googlegroups.com
Nginx 2.x supports HTTP 1.1 proxy_pass, won't web socket proxy works out of the box?

- Didip -

Nick Jennings

unread,
Jul 8, 2012, 7:10:52 PM7/8/12
to python-...@googlegroups.com
Hi Alek,

Thanks for the reply, I'd already come across this article, however
as I'm already using nginx 1.1.x I was hoping there was some other
solution rather than downgrading. 1.1.x has a lot of other
improvements over the 1.0.x branch.

Cheers
Nick

Nick Jennings

unread,
Jul 8, 2012, 7:11:54 PM7/8/12
to python-...@googlegroups.com
Hi Alek - I should add, I just checked out the
nginx_tcp_proxy_module's github page, and it seems it works with the
latest 1.1.x so I stand corrected! :)


On Mon, Jul 9, 2012 at 1:10 AM, Nick Jennings

Nick Jennings

unread,
Jul 8, 2012, 7:12:10 PM7/8/12
to python-...@googlegroups.com
Hi Didip, is 2.x stable?

Didip Kerabat

unread,
Jul 8, 2012, 7:19:22 PM7/8/12
to python-...@googlegroups.com
I've deployed 1 production app with it, and i haven't encountered any problems with it.

- Didip -

Nick Jennings

unread,
Jul 8, 2012, 7:29:34 PM7/8/12
to python-...@googlegroups.com
Hi Didip,

Sorry, I'm a little confused. There is no Nginx 2.x branch. Do you mean 1.3.x ?

Didip Kerabat

unread,
Jul 8, 2012, 7:38:47 PM7/8/12
to python-...@googlegroups.com
crap. I meant 1.2.x, and it seems like 1.3.x is out as well (Should have double checked before suggesting).

That said, i have not tried to proxy web socket yet.

If you do decided to upgrade, can you share your experience with web socket proxy here?

- Didip -

Nick Jennings

unread,
Jul 8, 2012, 7:49:34 PM7/8/12
to python-...@googlegroups.com
I came across this post while doing some searching:
http://stackoverflow.com/questions/10329281/nginx-1-2-0-socket-io-http-1-1-proxy-websocket-connections

Seems the 1.2.x branch does not support websockets out of the box. The
1.3.x branch plans on it, but it's unclear if it's done yet.

So I think my best bets are to either use the nginx_tcp_proxy_module
on the 1.2.x branch, or to try HAProxy (which apparently supports
websockets).

-Nick

xin zou

unread,
Jul 9, 2012, 7:08:17 AM7/9/12
to python-...@googlegroups.com
Hello,

Here is my gist (I had the same issue for this) for a simple configuration for the websocket with the HAProxy, hope it is helpful for you.

https://gist.github.com/3075716

2012/7/9 Nick Jennings <nick.sil...@gmail.com>

Nick Jennings

unread,
Jul 10, 2012, 11:45:18 AM7/10/12
to python-...@googlegroups.com

Thanks! I'll give that a try.

Reply all
Reply to author
Forward
0 new messages