HAProxy community

Can I define a 'network list' in globa/defaults to be used in acl

Can I define a ‘network list’ in globa/defaults to be used in acl. Something like this


And then use an acl like :
acl network_allowed src localnets

No, but there is a feature request open to define multiple patterns in an environment variable:

Until then, you’d have to either use single patterns in (global) environment variables or duplicate the acl setting in all sections.

I’m doing something along these lines, but using external files.

I’ve got files set up in /etc/haproxy/ipranges along the lines of product_prod.subnets and then in each a list of the subnets for it, i.e.:

Then, in my acl I’ve defined:

acl product_prod src -f /etc/haproxy/ipranges/product_prod.subnets
1 Like