Hello,

I use the redirect directive to redirect users from old sites to a new site, eg:
    redirect prefix http://new-site.com code 301 if old-site

I would like to redirect requests from many old sites to the same new site, so I need a way to add info about the old host in the new redirected request.

I'm looking for a way to add a header to the redirected request to identify the host, for example :
X-Orig-Site: old-site-123.com

Is this possible ?

I guess I can't add a header to the request with HAproxy, since HAproxy only sends a new Location header to the browser, and the browser sets the headers.

So, is there a way to alter the location sent in the redirect, to include « &orig-site=old-site-123.com » ?

I think I'm missing something here.
Should I user « http-request redirect » instead of « redirect prefix » ?


By the way, I tried to use the set-cookie option for this, but it was a bad idea : redirect prefix http://new-site.com code 301 set-cookie ORIG=%[hdr(host)] if old_site

This doesn't work for two reasons :

1. The « %[hdr(host)] » part is send literally in the request :
Set-Cookie: ORIG=%[hdr(host)]; path=/;

2. The request sent to new-site.com doesn't seem to include this cookie


Sylvain

Reply via email to