解析切换规则时检测到 HAProxy 错误:没有这样的 ACL:'{hdr(host)'
HAProxy error detected while parsing switching rule : no such ACL : '{hdr(host)'
正在为我们的底层环境配置带 SSL 的 HAProxy。目前,LB 正在为非 SSL 工作,但我们正在转换为使用 SSL。我们在 QA 中有多个站点,对于非 SSL,我正在使用 ACL,它工作正常。
出于某种原因,当我重新启动服务时收到以下错误:
Dec 9 10:56:11 haproxy haproxy:[ALERT] 343/105611 (52875):解析 [/etc/haproxy/haproxy.cfg:27]:解析切换规则时检测到错误:没有这样的 ACL:' {hdr(主机)'。
这是我当前的 SSL 配置:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option dontlognull
option forwardfor
option http-server-close
stats enable
timeout connect 5000
timeout client 50000
timeout server 50000
frontend qa_b2b_https_front
mode http
bind *:443 ssl crt /etc/haproxy/certs.d/
use_backend qa_b2b_http_back if {hdr(host) -i qawebsecure.oursite.com}
backend qa_b2b_http_back
server qab2b 10.5.140.176:80 check
要定义匿名 ACL,您必须在左大括号和右大括号前后添加 space。
关于这个话题引用the documentation:
It is also possible to form rules using "anonymous ACLs". Those are unnamed ACL
expressions that are built on the fly without needing to be declared. They must
be enclosed between braces, with a space before and after each brace (because
the braces must be seen as independent words).
因此,您的 use_backend
规则应该如下所示:
use_backend qa_b2b_http_back if { hdr(host) -i qawebsecure.oursite.com }
正在为我们的底层环境配置带 SSL 的 HAProxy。目前,LB 正在为非 SSL 工作,但我们正在转换为使用 SSL。我们在 QA 中有多个站点,对于非 SSL,我正在使用 ACL,它工作正常。
出于某种原因,当我重新启动服务时收到以下错误:
Dec 9 10:56:11 haproxy haproxy:[ALERT] 343/105611 (52875):解析 [/etc/haproxy/haproxy.cfg:27]:解析切换规则时检测到错误:没有这样的 ACL:' {hdr(主机)'。
这是我当前的 SSL 配置:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
option dontlognull
option forwardfor
option http-server-close
stats enable
timeout connect 5000
timeout client 50000
timeout server 50000
frontend qa_b2b_https_front
mode http
bind *:443 ssl crt /etc/haproxy/certs.d/
use_backend qa_b2b_http_back if {hdr(host) -i qawebsecure.oursite.com}
backend qa_b2b_http_back
server qab2b 10.5.140.176:80 check
要定义匿名 ACL,您必须在左大括号和右大括号前后添加 space。
关于这个话题引用the documentation:
It is also possible to form rules using "anonymous ACLs". Those are unnamed ACL expressions that are built on the fly without needing to be declared. They must be enclosed between braces, with a space before and after each brace (because the braces must be seen as independent words).
因此,您的 use_backend
规则应该如下所示:
use_backend qa_b2b_http_back if { hdr(host) -i qawebsecure.oursite.com }