Skip to main content

HAProxy tips and tricks

Checking to see if an ACL is present in HAProxy

For when you  aren't sure if the whole process is working, you can manually connect to the haproxyHAProxy socket and print out the contents.

socat is the way forward here. Install it with your favourite package manager, and then run something like this:
$grep socket /etc/haproxy/haproxy.cfg |grep admin to get the socket path:

stats socket /run/haproxy-stats.sock mode 0660 level admin user haproxy group haproxy

then:

echo "show acl #202" |socat /run/haproxy-stats.sock stdio

being the path you grepped out of the config above. This command requests the contents of ACL 202 from haproxy.HAProxy. ACL 202 in this example is the relevant ACL number in your haproxyHAProxy config. 

You should see something like:
0x556b19ecd4a0 200.206.23.125 in the output if it works.