Reference

add acl

Add a value to an ACL expression or file.

Description Jump to heading

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:

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

Here, there is initially one value, /images/. Use add acl to add another value.

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 add acl command to add a new entry to the file. Note that this only adds it to the load balancer’s runtime memory and not to the file on disk.

Examples Jump to heading

Use add acl to add the value /scripts/. Specify the acl file using either the path or the ID. Here we specify the ID of the ACL:

nix
echo "add acl #0 /scripts/" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "add acl #0 /scripts/" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

This updates the ACL so that it represents this expression:

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

In the next example, we add the value /stylesheets/ to the ACL file /etc/hapee-2.9/paths.acl.

nix
echo "add acl /etc/hapee-2.9/paths.acl /stylesheets/" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "add acl /etc/hapee-2.9/paths.acl /stylesheets/" | \
sudo socat stdio tcp4-connect:127.0.0.1:9999

See also Jump to heading

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