Peter
Peter

Reputation: 3184

Possible to do conditions on a path_beg?

I'm wondering if it's possible to add some conditional operators in a path_beg acl.

For example I'd like to do something like this:

acl myacl path_beg /samples { and !path_beg /samples/view }

Where the myacl is triggered for anything that lives at /samples but is not triggered if the path is /samples/view

Upvotes: 0

Views: 2277

Answers (1)

Holger Just
Holger Just

Reputation: 55833

This can not be defined on the ACL level but when using the ACL in a rule:

acl myacl path_beg /samples
acl myacl_exceptions path_beg /samples/view

use_backend mybackend if myacl !myacl_exceptions

As you can see, you can define two separate ACLs which you then use to define a full condition. Note that in this case, the two ACLs are combined with a logically AND. There are other options to combine multiple ACLs. Please refer to the documentation for details.

Note that you can also use anonymous ACLs. An equivalent example with an anonymous ACL for the exceptions could look like this:

acl myacl path_beg /samples
use_backend mybackend if myacl ! { path_beg /samples/view }

Upvotes: 2

Related Questions