HAProxy Enterprise Documentation 2.0r1

Inline ACLs

Although you can define an ACL on its own by using the acl directive, in which case it can be referenced on another line by name:

frontend www
   bind :80
   acl api_url path_beg /api/
   use_backend api_servers if api_url

backend api_servers
   server s1 192.168.50.20:80

You can also declare the ACL inline by surrounding the expression with curly braces:

frontend www
   bind :80
   use_backend api_servers if { path_beg /api/ }

backend api_servers
   server s1 192.168.50.20:80

Next up

Predefined ACLs