HAProxy Enterprise Documentation 2.0r1

clear acl

Delete all entries from an ACL expression or file.

Description

An ACL is split into four parts:

  • a name for the ACL, which you choose

  • a fetch to collect information from the client's session

  • optional flags

  • a value to match against

In the example below, we mark these parts:

frontend www
   bind :80
   #   name       fetch  flags       value
   acl static_url  path   -i -m beg   /images/ /scripts/

Here, there is initially two values, /images/ and /scripts/. Use clear acl to delete all values.

You can also store values in a file and then reference that file in an acl statement by using the -f /path/to/file flag. Use the clear acl command to delete all values from the file. Note that this only removes it from HAProxy Enterprise's runtime memory and not to the file on disk.

Examples

In this example, we start with the following ACL expression in the configuration, which checks whether the requested URL path begins with /images/ or /scripts/:

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

First, display a list of defined ACLs by calling show acl:

$ echo "show acl" | socat stdio tcp4-connect:127.0.0.1:9999

# id (file) description
0 () acl 'path' file '/etc/hapee-2.0/hapee-lb.cfg' line 51

Use clear acl to remove the values /images/ and /scripts/. Pass to it the ID of the ACL:

$ echo "clear acl #0" | socat stdio tcp4-connect:127.0.0.1:9999

ACL values may also be stored in a file. Given you have a file named paths.acl with the following list of values:

/images/
/scripts/

You would reference this file with an ACL expression like this:

frontend www
   bind :80
   acl static_url path -i -m beg -f /etc/hapee-2.0/paths.acl

In the next example, we remove all values from the ACL file /etc/hapee-2.0/paths.acl:

$ echo "clear acl /etc/hapee-2.0/paths.acl" | socat stdio tcp4-connect:127.0.0.1:9999

See also


Next up

Lua scripts