I have successfully configured HAProxy to load balance my sites, and it is working fine. However, I need assistance with blocking direct access to certain URLs such as example1.com, example2.com, and example3.com.
Here is the current HAProxy configuration that I have set up:.
frontend http80
bind *:80
timeout client 60s
mode http
default_backend allservers
# Deny direct access to example1.com:8111
acl deny_example1 hdr(host) -i example1.com
acl deny_example2 hdr(host) -i example2.com
acl deny_example3 hdr(host) -i example3.com
http-request deny if deny_example1
http-request deny if deny_example2
http-request deny if deny_example3
backend allservers
balance roundrobin
timeout connect 10s
timeout server 100s
mode http
server server8111 example1.com:8111
server server8112 example2.com:8112
server server8113 example3.com:8113
Can you please guide me on that.