问题原文
原帖链接 · David Perry · CC BY-SA 3.0
I have an HAProxy config file that's being built programmatically and I'm getting an error like the following for every single backend that's defined:
[WARNING] 073/153725 (1663) : parsing [/etc/haproxy/haproxy.cfg:964] : 'use_backend' ignored because backend 'bk_10716' has no frontend capability.
My config file is fairly straightforward and a simplified version with just one backend seems to work, so I can't put my finger on what's wrong.
My config file consists of this:
global
tune.ssl.default-dh-param 2048
log 127.0.0.1 local1 debug
chroot /var/lib/haproxy
user haproxy
group haproxy
maxconn 4000
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
listen stats
bind *:1234
stats auth admin:bdi2016
stats uri /
stats realm Haproxy\ Statistics
stats enable
mode http
frontend http:
bind *:80
mode http
option httpclose
option forwardfor
followed by a great number of these:
use_backend bk_10011 if { hdr_end(host) -i somedomainname.com }
backend bk_10011
server server_10011 127.0.0.1:10011 check
Am I just missing something obvious/stupid?
已采纳解答
原帖链接 · David Perry · CC BY-SA 3.0
It was just a dumb mistake. I needed to specify all of my use_backend if statements within the frontend instead of above each individual backend. This is why it worked with only one backend, because regardless of indentation the first use_backend "belonged" to frontend http: and every subsequent backend appeared orphaned.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
