HAPROXY 中 ACL 的子域中的通配符

Wildcard in subdomain for ACL in HAPROXY

尝试在 haproxy 中匹配以下内容:

acl instagiveweb hdr_beg(host) -i foo*.something.com

其中 url 可能是 foo-staging.something.comfoo.something.com

我查看了 https://www.haproxy.com/doc/aloha/7.0/haproxy/acls.html#data-types-and-matching-between-samples-and-patterns 上的文档,但很难找到我需要的模式匹配。

感谢任何帮助!

你想要hdr_reg()("reg"ex),而不是hdr_beg()(文字字符串前缀/"beg"inning)。

acl instagiveweb hdr_reg(host) -i ^foo[^\.]*\.example\.com$

这应该匹配整个主机 header 仅当以 foo 开头后跟 0 个或多个除 . 之外的任何字符后跟 .example.com 结束时值。