Haproxy ACL rule for a particular domain
5,236
You can list multiple ACLs in the if
condition
http-request deny if blockedagent grow_mydomain
Related videos on Youtube
Author by
Cyberzinga
Updated on September 18, 2022Comments
-
Cyberzinga over 1 year
In my Haproxy config I have few ACL rule set. My haproxy.config looks like,
frontend incoming bind *:80 acl grow_mydomain hdr(host) grow.mydoamin.com use_backend grow_mydomain if grow_mydomain acl staging_mydomain hdr(host) staging.mydomain.com use_backend staging_mydomain if staging_mydomain
Now, I want set another rule to block bad bots. New ACL rule, I want to add,
acl blockedagent hdr_reg(user-agent) -i -f /etc/haproxy/badbots.lst http-request deny if blockedagent
Now, I want to apply the
badbots
ACL rule only for the domaingrow.mydomain.com
. It should not consider the domainstaging.mydomain.com
I tried the below approach, but it is not working. Because, it is considering both the domains.
frontend incoming bind *:80 acl blockedagent hdr_reg(user-agent) -i -f /etc/haproxy/badbots.lst http-request deny if blockedagent acl grow_mydomain hdr(host) grow.mydoamin.com use_backend grow_mydomain if grow_mydomain acl staging_mydomain hdr(host) staging.mydomain.com use_backend staging_mydomain if staging_mydomain
What is the recommended way to achieve this ?