haproxy - acl 的 haproxy 嵌套条件
问题描述
我需要嵌套 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)
匹配后端。与此等效的正确 HA 代码是什么?
解决方案
单个 ACL 中的规则是 ORed,因此,您可以将route2
androute3
规则与此组合:
acl route2 path_beg /m1
acl route2 path_beg /m2
use backend back1 if route1 route2
条件也支持||
运算符,但不支持优先级的括号分组,所以a b || c
意味着(a and b) or (c)
,这不等于你想要的......所以如果你不想像上面显示的那样组合 ACL,你需要这个......
use backend back1 if route1 route2 || route1 route3
...这并不完全直观。
或这个:
use backend back1 if route1 route2
use backend back1 if route1 route3
推荐阅读
- java - 原因:java.lang.ArrayIndexOutOfBoundsException: 7786 ANT build java web-application failed to deploy
- excel - Excel - “表达式.错误:未找到表的“日期”列”,即使它存在于表中
- r - R读取基于CSV的数据子集
- mysql - Mysql-cast 和 convert in join 不起作用
- r - 在R中的矩阵中找到最上面的'1'和最下面的'1'之间的垂直距离
- flutter - 在颤振导航器上启动另一个页面时如何调用析构函数?
- java - Maven 无法识别添加的软件包
- rust - 如何制作一个在调用开销和处理速度方面与 C-Extensions 完全一样的 Python “rust-Extension”模块?
- apache-spark - 基于另一列的滞后窗口函数
- flyway - 在具有现有表的数据库上运行 flyway 迁移