V
V
Vladimir Abramov2013-01-15 23:32:13
JavaScript
Vladimir Abramov, 2013-01-15 23:32:13

Who knows how to forward a websocket through nginx with little bloodshed?

Who knows how to forward a websocket through nginx with little bloodshed?

There is a task:

Server on play2! (it doesn't matter. listens to port 9000). Depending on the url, it returns either a regular html content or static content or a websocket connection.

Before that, nginx sits as a reverse_proxy from port 80 to my server. The problem is that the current stable version cannot just proxy a websocket connection. There is a solution www.letseehere.com/reverse-proxy-web-sockets , but I don’t like it because the socket and conent will be given from different ports, which works for me if I connect directly to the socket on port 9000.

Has anyone encountered such a problem? Are there alternative solutions, for example on lighttpd? Maybe this is not a problem at all?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kastigar, 2013-01-16
@kastigar

Try haproxy. The first link on google is very similar to what you need.

S
Semyon Dubina, 2013-01-16
@sam002

Not a problem at all. The solution from the link you provided is fine-tuned for any port configuration.
If WS has access to an external network, then what else do you want from it?
Through nginx, it is convenient to balance the load on several servers in this way. Or do you want to mix several protocols on one port? Then it is better to proxy through a subdomain, so as not to be mistaken))

I
Ilya Kantor, 2013-01-19
@iliakan

Varnish will also work - an excellent caching proxy, through nginx there is no way without a patch, anyway.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question