I want to combine 2 different types of acl in haproxy (src
and path_beg
) to make a decision about which backend to use.
I tried the following which is not valid syntax:
acl my_ip src 192.168.0.50
acl api_path path_beg /api
use_backend private_backend if my_ip AND api_path
use_backend public_backend if api_path
The AND
in the 3rd line does not work.
I've also tried the following which is not valid syntax:
acl my_ip_and_api_path src 192.168.0.50 path_beg /api
Using path_beg
after the src
and the IP doesn't work.
Please make sure that the IP address you are connecting from is indeed the mentioned 192.168.0.50 and it's better to note single IP's with a /32 range. Also, remove the AND in the if statement. It is implicit and is known to cause some invalid syntax in some cases if used. So a working configuration for you should be: