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:

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

It returns match=yes.

See also Jump to heading

If this page was useful, please, Leave the feedback.

© 2023 HAProxy Technologies, LLC. All Rights Reserved
Manage Cookie Preferences