HAProxy community

Want to match optional trailing slash


I’m running 1.6.9 built recently with USE_PCRE=1 on my Raspberry Pi. I want to allow the URLs


to match

What I tried was

acl mysubdir_req path_beg /subdir/?

using the ‘?’ PCRE regex for “0 or 1” matching but it doesn’t work.

If I remove the ? it does work as long as I include the trailing slash which is what I expected.


path_beg is not a regex.

acl mysubdir_req path_reg ^/subdir/?

or better yet avoid the regex and just write:
acl mysubdir_req path_beg /subdir/ /subdir


Ah! NOT a regex? Well, I’ll have to watch out for that. Thanks!