Use backend if usr_path*


#1

Hi folks, looking for some assistance in using wildcards / regexp in backend switching. For example i’ll have 100+ acl rules for path_beg /pathname and if these acl rules are matched I want to use a specific backend.

So I create acl declarations with a generic prefix “usr_” and want to say use backend if usr_path_* a snippet of code to help explain is below.

acl host-is-www hdr(host) eq www.domain.com

acl usr_path_path1 path_beg /path1
acl usr_path_path2 path_beg /path2
acl usr_path_path3 path_beg /path3

use_backend user if host-is-www usr_path*

default_backend www

backend www

server www1 x.x.x.x:443 check ssl…
server www2 x.x.x.x:443 check ssl…

backend user

server user1 x.x.x.x:443 check ssl…
server user2 x.x.x.x:443 check ssl…

Is this doable or do I need to create a use_backend declaration for each usr_path_pathname individually?

Thanks.

UPDATE :

I tried putting all my paths on a single acl declaration, however that returned a line too long error so I will have to do multi acls?

i.e.

acl user_paths path_beg /path1 /path2 /path2/a /path3

use backend user if host-is-www user_paths