Sunday, May 3, 2015

load balancing - nginx proxy_redirect websockets, not proxy

I have been able to successfully set up nginx as a load balancer to proxy websocket requests (with SSL), however, really I think I need to be able to redirect them. My desired configuration is to have nginx sitting in front of a farm of websocket servers on different machines, and redirecting (not proxying) to them in round robin fashion. I don't want to proxy, because then nginx just ends up opening two concurrent connections (inbound + outbound) on the load-balancer. So even if my websocket farm can handle many concurrent connections per machine, the overall number of concurrent connections is limited by the load-balancer. I want the client to end up with a direct connection to the websocket server that does not go through nginx.



I have looked for an example of someone else doing this, and have not found much that seems very relevant. I think the directive I want to use is proxy_redirect, but, as mentioned, the documentation and other posts are thin on how to use it as described.



Am I trying to put a square peg in a round hole? What I've tried so far results in 404's. If possible, can someone recommend a setup, or where I could find more information? If this is an ambiguous/stupid/pointless question, please feel free to tell me why! I don't get my internet feelings hurt - just want to figure out how to scale my setup...




I am thinking of an alternate approach where the websocket server ip address could be served up through js. Does anyone have any experience with anything like this? Bueller...

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...