Answer the question
In order to leave comments, you need to log in
Has anyone managed to proxy Socket.io through nginx?
In their "Development Version" nginx claims to support HTTP 1.1 proxying. Which should allow the use of websockets through the nginx proxy_pass instruction.
On the Internet I found several similar descriptions of configs. For example, here: nabeelio.com/2012/01/node-js-and-nginx/ and here gist.github.com/1542161
However, I did not succeed in making Websockets work in Socket.io. Has anyone succeeded?
The version of nginx with which I am experimenting is 1.1.18.
UPDATE : solution found in a year :) habrahabr.ru/post/171757/
Answer the question
In order to leave comments, you need to log in
"Which should allow the use of websockets through the nginx proxy_pass instruction."
This is an erroneous assumption.
I got it using github.com/yaoweibin/nginx_tcp_proxy_module but I wouldn't risk it in production yet
Not exactly an answer to your question, but perhaps your situation is similar to mine, and then a similar approach will help.
I ran into this just two days ago, only not with socket.io, but with faye (http://faye.jcoglan.com), which are basically the same eggs.
It was necessary to forward websocket requests from a specific url of the main domain and port 80 to the port of an asynchronous server on the same domain.
I did not find a solution with nginx, which suited me (I considered the options in the comments above), but in the end I realized that I was approaching the problem on the wrong side.
The problem was that because cross-domain faye transports do not work correctly in all browsers, then I started sending faye requests to the main domain, and there, at the nginx level, split traffic between web servers (this is where web sockets did not pass).
And in the end I realized that I just need to open the connection websocket at a separate address directly to the asynchronous web server, and leave everything else as it is - send it to the 80th port of the main nginx domain.
github.com/faye/faye/pull/134
I want to do without HAProxy, and port 80 is needed in case a non-standard port is blocked. How I personally get around this now - I wrote above.
If there is a way to have the same external IP on the same server for different hosts (or for different hosts and different IPs, but again on the same server) for a server on Ubuntu - at least tell me the direction where to dig :) This will be a better solution, than checking if the port is blocked and rolling down to long polling if the port is blocked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question