-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nginx Reverse proxying / Multiple HTTP servers #47
Comments
I think you should use https://github.com/indutny/sticky-session with https://github.com/socketio/socket.io-redis Something like this:
Of course, you should install redis server. http://redis.io/download |
I can confirm the suggestion of @Mad-Head . I use the same approch in a production env and works very well! |
Yes, but the problem is that sticky session doesn't work with proxies (as it uses IP to transfer the requests to the right cluster, it would always show 127.0.0.1 as the IP). I could be mistaken though, and I haven't even tried because I actually just solved my problem. I decided to drop the longpolling transport for socket.io and now only use websocket transport, which only needs 1 request to make the initial connection. This means it won't work on some platforms, but I don't really care for my project. So I don't need to use sticky-sessions anymore, or any other code that would help me retrieve and store the real IP of the original request. Thanks anyway to you two! |
Have you tried it? http://socket.io/docs/using-multiple-nodes/#nginx-configuration |
Hi.
My issue is summed up here: http://stackoverflow.com/questions/37911155/nodejs-clusters-socket-io-redis-nginx
I am aware of issue #24 , issue #6 and PR #45 , but they sadly haven't been answered.
What I want to know is if what I'm trying to do is even possible? If it isn't, what should I do instead?
Wouldn't just allowing the websockets transport be a good solution to avoid the multiple requests?
The text was updated successfully, but these errors were encountered: