I currently have a virtual machine that acts as a web server using Apache. This hosts a couple of different sites, with that being handled by Apache and Virtual Hosts.

I want to let someone play around with HA Proxy, with the load balancer being on my web server, and the nodes elsewhere. What I want to know is this: can HA Proxy be told to only intercept traffic meant for certain URLs? Obviously I'll have multiple sites running on one IP, with just one of them needing to be routed via HA Proxy.

1 Answer
1

You can configure haproxy frontends to evaluate host headers and/or URIs via acl directives and forward traffic to the respective backend(s). But haproxy would not be able to "share" the TCP port used by Apache (80) on the same IP address - simply due to the way TCP sockets are implemented. You certainly could set up different frontends in haproxy - one directing traffic to the "nodes-elsewhere" backend and one for your local Apache backend using the aforementioned acl directives like this:

But if you want other people to "play around with HAProxy", they probably would want to play around with the configuration as well - with the potential of breaking your local backend. So it might be easier to just use a different IP address and/or a different port for your HAProxy frontend than what is used by Apache.