Regex ACL haproxy


#1

Hi,

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 !


#2

Hi @Orrmor94
maybe this help you :

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


#3

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?


#4

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


#5

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.


#6

Let me ask again:

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