HAProxy community

Regex ACL haproxy



I am trying to get every POST request to:
/admin/file-manager/*/do-upload, while * can be any number (0,3524,76 etc…) to specific server.

I have tried to do it like that:

acl is_upload_url path_reg ^/admin/file-manager/…/do-upload/…$
use-server myserver if is_upload_url

But it doesn’t seems to work

any suggestions?

Thanks !


Hi @Orrmor94
maybe this help you :

acl is_upload_url path_reg \/admin\/file-manager\/[0-9]*\/do-upload.*


I do have a similar requirement but need to redirect to a new URL depending on the regex pattern but only if the regex matches.

Request Path: /path/to/something/filename-XX-YY.pdf
Redirect Path: /XX-YY/something

Is that possible as well?


create an ACL then use it in the condition of http-request


Sure, but how do I use XX-YY from the request to put that into the destination? My question probably wasn’t clear enough such that XX-YY is variable and should be taken from the request and put into destination.


Let me ask again:

Is it possible to use the found number by [0-9]* as a string in the redirect destination?