HAProxy community

Configuration File Questions for Mulitple Instances


So I run run multiple instances of haproxy on the same box for various applications; I simply create a another service file with the new parameters. This allows me to only mess with one application without affecting the other applications. So when I load haproxy, I have -f $BASECONFIG -f $APPCONFIG … where

I was hoping that I could put my ACLs in my the haproxy-common.conf but it appears that they can only be defined in the frontend or backend stanzas. It also appears that you can’t duplicate listen, frontend, backend stanzas with the same name; I was hoping to have the common settings for stats defined in haproxy-common with only the app unique stuff in haproxy-webapp1.conf.

Is there a better way to do this keeping the haproxy instances separated for each application? Is there someplace I can define ACLs once in the haproxy-common.conf file and reference them in the other configuration files?

Also, is there a way to have HAPROXY use a different IP for polling but another for actual client connections? It seems like it would be easier when capturing packets to filter out the probes.
Anyhow, I thought I’d ask since I an new to haproxy.



Unfortunately (to my knowledge) HAProxy doesn’t support frontend / backend “overrides” (as you seem to want to implement), nor includes.

However you could try to use cpp -P haproxy-webapp1.conf and use plain old C-style #include "haproxy-common-acl.conf" in various places to pre-process your configuration file. (You could also use something more advanced like m4.)

(In my use-cases I’ve used a Python based configuration generator tailored to my needs.)


Apparently there is the addr option exactly for this purpose.