【问题标题】:Match regex/wildcard against http header NAMES in haproxy将正则表达式/通配符与 haproxy 中的 http 标头名称匹配
【发布时间】:2018-08-04 04:49:08
【问题描述】:

我想添加一个 acl 规则来捕获与以下正则表达式匹配的标头 name 的存在:^X-\w+-Signature(或任何通配符)。匹配示例:

X-Abc-Signature
X-Whatever-Signature
X-Service-Signature

我知道我可以明确地创建如下规则:

acl has_abc_token req.fhdr(X-Abc-Signature) -m found
acl has_whatever_token req.fhdr(X-Whatever-Signature) -m found
acl has_service_token req.fhdr(X-Service-Signature) -m found

甚至可以在 haproxy 中做到这一点吗?

另外,我的理解是haproxy中的\w字符类does not exist

看起来req.hdr_names() 可能是我正在寻找的,但我不知道如何使用它。

【问题讨论】:

    标签: regex http-headers haproxy


    【解决方案1】:

    没关系。我想通了:

    acl has_sig req.hdr_names() -m reg -i ,X-[A-Za-z]+-Signature
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-22
      • 1970-01-01
      • 2014-07-14
      • 1970-01-01
      相关资源
      最近更新 更多