我需要嵌套的 ACL 条件
acl route1 hdr_sub(host) -i abc.com hdr_sub(host) -i xyz.com
acl route2 path_beg /m1
acl route3 path_beg /m2
use backend back1 if route1 (route2 or route3)
// essentially
route1 AND (route2 OR route3)
Run Code Online (Sandbox Code Playgroud)
匹配后端。与此等效的正确 HA 代码是什么?
单个 ACL 中的规则是 ORed,因此,您可以将route2和route3规则与此组合:
acl route2 path_beg /m1
acl route2 path_beg /m2
use backend back1 if route1 route2
Run Code Online (Sandbox Code Playgroud)
条件也支持||运算符,但不支持优先级的括号分组,因此a b || cmean(a and b) or (c)不等于您想要的...所以如果您不想组合如上所示的 ACL,您将需要这个...
use backend back1 if route1 route2 || route1 route3
Run Code Online (Sandbox Code Playgroud)
...这并不完全直观。
或这个:
use backend back1 if route1 route2
use backend back1 if route1 route3
Run Code Online (Sandbox Code Playgroud)