Reference

get acl

Test whether a value would match an ACL.

Description Jump to heading

This command returns a result that indicates whether a value would match an ACL expression. An ACL is found by its ID, which comes from the output of the command show acl. This is useful for debugging ACLs.

Examples Jump to heading

We start with the following ACL expression in the configuration, which checks whether the requested URL path begins with /images/:

haproxy
frontend www
bind :80
acl static_url path -i -m beg /images/
haproxy
frontend www
bind :80
acl static_url path -i -m beg /images/

Test a value against an ACL that you reference by its ID.

In the example below, we test the value /images/test.jpg against the ACL with an ID of 0:

nix
echo "get acl #0 /images/test.jpg" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "get acl #0 /images/test.jpg" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
output
text
type=beg, case=insensitive, match=yes, idx=list, pattern="/images/"
output
text
type=beg, case=insensitive, match=yes, idx=list, pattern="/images/"

It returns match=yes.

See also Jump to heading

Do you have any suggestions on how we can improve the content of this page?