Last Updated: February 25, 2016
·
1.63K
· basicallydan

Use HAProxy alongside Apache & a Websocket Server, both on port 80

Having trouble with firewalls blocking your users from that new websocket server you set up on port 3000? Can't put it on port 80 because that's where you're using that for HTTP with Apache? Can't be arsed with modules, or switching to Nginx?

Quick and easy solution: Set up HAProxy (a load balancer) to point different sub-domains to different ports internally. E.g.:

http://ws.mydomain.com:80 -> http://mydomain.com:3000
http://www.mydomain.com:80 -> http://mydomain.com:8080

Problem solved :) works great with socket.io too.