Score:0

HAProxy Combined Acls

cn flag

I'm trying to make a combined acl in the haproxy config.
Is this kind of thing possible ??

  acl bare-dom1 hdr(host) -m reg -i domain1.org(:[0-9]+)?$
  acl bare-dom2 hdr(host) -m reg -i domain2.org(:[0-9]+)?$
  acl bare-dom3 hdr(host) -m reg -i domain3.org(:[0-9]+)?$
  acl needs-www (bare-dom1 || bare-dom2 || bare-dom3)

Unfortunately from looking around so far, I don't see a way to do it. Yeah sure I could add the big OR to the place where I'm going to use it, but maybe I will have 20 domains later, and if I'm gonna use it in multiple places its going to get ugly.

Score:2
jp flag

You can repeat an ACL with the same name multiple times, they will be combined as with 'OR' operator.

Example:

acl bare-dom hdr(host) -m reg -i domain1.org(:[0-9]+)?$
acl bare-dom hdr(host) -m reg -i domain2.org(:[0-9]+)?$
acl bare-dom hdr(host) -m reg -i domain3.org(:[0-9]+)?$
use_backend backend bare-dom

I don't think it is possible to combine named ACLs into another named ACL.

cn flag
Thanks, seems good, but the last line of setting a new acl, just based on another acl still doesn't seem to work. Unless anyone has other ideas, I can just use needs-www as the main variable in the first 3 lines. Of course the disadvantage of this, is that I cannot use bare-dom1 bare-dom2 etc in future conditions. Would be awesome if haproxy just implemented this "new acl from existing acls" feature alonng with the use of full logical operators.
jp flag
@blissweb You are right, I copied the last line without thinking. I don't think it is currently possible to combine named ACLs into another named ACL
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.