I have the following configuration setup which works fine:
frontend http-in bind *:80 mode http option http-server-close option forwardfor option httplog acl redirect_domain hdr(Host) -i example1.com acl redirect_domain hdr(Host) -i example2.com acl redirect_domain hdr(Host) -i example3.com http-request redirect location https://my-new-domain.com/ code 302 if redirect_domain default_backend web_default
This redirects my example[1-3].com to my-new-domain.com with a 302 redirect (Yes, I want the 302).
Now what I want to achieve is passing the original url to the “my-new-domain.com”, but the problem is that the URL won’t be encoded:
http-request redirect location https://my-new-domain.com/?referer=%[hdr(host)]%[url] code 302 if redirect_domain
This results in the URL to be build like:
While it should look like:
Is there any way how I can get HAProxy to apply url encoding to my referer param?