Tom,

On 5/11/21 4:15 PM, Tom wrote:
Using haproxy 2.1.3:
I've configured multiple conditions to a "use_backend" directive like this:

use_backend example_192.168.1.30 if host_test.example.com || host_a01.test.example.com || host_a02.test.example.com || host_a03.test.example.com || host_a04.test.example.com || ... || ...

When I add some more conditions, then I got an error after reloading the daemon:

"line too long, truncating at word 65, position 783:..."


How can I configure more conditions in the "use_backend"-directive above without having the error?


In this specific case (using ||) you can just repeat the 'use_backend' directive in multiple lines:

use_backend example_192.168.1.30 if host_test.example.com
use_backend example_192.168.1.30 if host_a01.test.example.com
use_backend example_192.168.1.30 if host_a02.test.example.com
use_backend example_192.168.1.30 if host_a03.test.example.com

As Adis said you can also define the same ACL multiple times:

acl test_dot_example req.hdr(host) test.example.com
acl test_dot_example req.hdr(host) a01.test.example.com
acl test_dot_example req.hdr(host) a02.test.example.com
acl test_dot_example req.hdr(host) a03.test.example.com

use_backend example_192.168.1.30 if test_dot_example

Best regards
Tim Düsterhus

Reply via email to