Try to redirect path to another

Hello,

I’m new with haproxy and i like to redirect a path to another. I tried several method but nothing work.

The goal is to redirect https://domain.tld/**reports**/xxx to https://domain.tld/**document-generation**/xxx

I tried with someting like :

http-request set-path %[url,regsub(^/reports/,/document-generation/)] if { path_beg /reports }

or

http-request set-uri %[path,regsub(/reports/,/document-generation/)] if { path_beg /reports }

or

rspirep ^Location:\ (https?://domain.tld)?(\/reports\/)?([0-9A-Z]*) Location:\ /document-generation/\2 if { path_beg /reports }

Thanks in advance for the help.

bertho