2016-05-12 33 views
4

尝试匹配HAProxy的以下内容:通配符子域的ACL在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,但不必通过文档看很难找到我需要的模式匹配。

任何帮助表示赞赏!

+0

如果接受正则表达式,请尝试'acl instagiveweb hdr_beg(host)-i foo [^。] *。something.com'或'acl instagiveweb hdr_beg(host)-i foo(-staging)?something.com ' –

回答

7

您想要hdr_reg()(“reg”ex),而不是hdr_beg()(文字字符串前缀/“求”局)。

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

这应该与只有当与foo随后除. 0或多个任意字符,接着.example.com在值的末尾开始的整个主机头。