I serve multiple services from my domain using the same HAProxy instance, at domain.com/s1/
and domain.com/s2/
. I would like to do some operations (including ACL matching) only when certain conditions are met within s2
. Using acl
's like
acl service_1 path_beg /s1/
acl service_2 path_beg /s2/
acl service_1_path_1 path_beg /s2/path1/
acl service_1_path_2 path_beg /s2/path2/
will lead to all requests being matches for the s2/path1/
and /s2/path2/
patterns, which is wasteful if I know that the vast majority of requests are for s1
.
Is there a way that I can say "evaluate for the path_1
or path_2
patterns only if the acl service_2
matches"?
Note that this is not a case of wanting to AND
two conditions; I want the second acl
to not even be computed unless the first one matches. Is that even possible in HAProxy?
Best Answer
HAProxy Multiple Condition Example
Here is one example I use:
Let the bots in and/or use http protocols other than 1.1 IF they hit
/
or.txt
files.We define multiple acl's, then set the condition and/or negating condition on the action.