HAProxy 配置中的正则表达式以匹配任何字符

Regex inside HAProxy configuration to match any character

我想将不在 https 上的某种类型的 URL 301 重定向到 http。正则表达式的语法不知何故不起作用:

redirect scheme https code 301 if { hdr(Host) -i ^project-.*$ } !{ ssl_fc }

它应该匹配 project-de、project-us 等。

如果没有正则表达式,该行将完美运行。

使用 -m 修饰符:if { hdr(Host) -m reg -i ^project-.*$ }if { hdr(Host) -m beg -i project- }