Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Bit of an odd question, and I know it's not ideal, but still.....

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.


share|improve this question
up vote 0 down vote accepted

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:

frontend all-sites
  bind *:80
  acl is_external hdr_end(host) -i
  use_backend nodes-elsewhere if is_external
  use_backend local-server if !is_external

backend nodes-elsewhere
  server external-node1
  server external-node2

backend local-server
  server local-host

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.

share|improve this answer
Cheers. I think a new VM and different ports is the way to go. Not ideal, but OK for testing purposes. – Oliver Haslam Jan 2 '13 at 10:42
@OliverHaslam if you create a different VM altogether, it is going to have a different IP address, so there would be no need to use a different port as well. – the-wabbit Jan 2 '13 at 12:42
Not externally, it wouldn't. – Oliver Haslam Jan 2 '13 at 17:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.