On 17/05/2018, Lotic Lists wrote:
> Hi experts
> 
> How can I rewrite a image path based on URL?
> 
> Example, users request the url www.example.com/images/logo.png, haproxy just
> balance to backend servers normally.
> 
> Now users request www.newdomain.com, I need rewrite URI to
> /images/new-logo.png

Well what have you already tried?

I would try, untested.

https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4.2-reqrep

acl old_dom hdr(host) -i www.example.com
acl old_path path_beg -i /images/logo.png

reqrep "^([^ :]*) /images/logo.png /images/new-logo.png" if old_dom && old_path
reqirep "^Host: www.example.com   "Host: www.newdomain.com" if old_dom && 
old_path

> Tks.
> 
> Marcelo

Regards
Aleks

Reply via email to