my haproxy version: HA-Proxy version 2.0.29-0ubuntu1.3 2023/02/13
I use balance source in my haproxy config.
for specific urls i want to use a specific backend server overriding this rule
use-server squidserver1 if { hdr(host),word(1, -i -m beg jufi1 }
server squidserver1 xx.xx.xx.xx:3129 check port 3129 weight 50
use-server squidserver2 if { hdr(host),word(1, -i -m beg jufi2 }
server squidserver2 yy…yy.yy.yy:3129 check port 3129 weight 50
This config always uses squidserver1
How can i debug if the acl matches.
Isn’t balance source
used to try to make sessions sticky? Seems like this config would try to use the first server unless you’re testing with multiple clients. Maybe test with balance roundrobin
or just comment it out since roundrobin is the default.
Beyond that, I would start by setting ACL’s and simplifying your criteria a bit. It looks like you’re trying to achieve something like this:
acl to_squid_1 hdr_beg(host) -i jufi1
acl to_squid_2 hdr_beg(host) -i jufi2
use-server squidserver1 if to_squid_1
use-server squidserver2 if to_squid_2
server squidserver1 xx.xx.xx.xx:3129 check
server squidserver2 yy…yy.yy.yy:3129 check
In this way, you can comment out one ACL or the other and see how the load balancing behaves.
Thnk you for your answer
This simplified criteria does not work in use-server rule:
error detected while parsing switching rule : no such ACL
The ACL must be explicit in use-server … if { hdr_beg(host) -i jufi1 }
I need(ed) this “balance source” for Google recaptcha.
i additionally used “hash-type consistent”. I commented out this rule and now the use-server works.
I will check the behavior the next days (also with respect to recaptcha)