Controlling access via HAProxy


#1

If you want to limit access through HAProxy (similar to Apache Access Control directives, or firewall rules), you can add code like the following 1

    acl goodguys src 10.0.0.0/24
    acl badguys  src 10.0.1.0/24
    tcp-request content accept if goodguys
    tcp-request content reject if badguys
    tcp-request content reject

#2

You can test your haproxy configuration with the -c option

sudo haproxy -f /etc/haproxy/haproxy.cfg -c
gives:

Configuration file is valid

if no problems are detected, and can be used even on a running haproxy.