HAProxy community

Rewrite/Redirect URL

Hello everyone,

I have searched the web but can’t figure it out.

I’m running hapee-2.0

I need to rewrite/redirect an URL to a new path:
http://oldservice.domain.com/otrs/customer.pl must be rewritten/redirected to https://newservice.domain.com

I have done the https and the oldservice.domain.com to newservice.domain.com redirect

The problem I have is that it still adds the last part of the URL in the new URL like this:
https://newservice.domain.com/otrs/customer.pl
I need the /otrs/customer.pl part to be completely removed

Config:
frontend:
redirect scheme https if { hdr(Host) -i newservice.domain.com} !{ ssl_fc }
redirect prefix https://newservice.domain.com code 301 if { hdr(host) -i oldservice.domain.com}

backend:
http-request set-path %[path,regsub(^/otrs/?,/)]

Any nudge in the right direction will be highly appreciated

Thanks
G