Am 21.01.2019 um 23:40 schrieb Joao Guimaraes:
> Hi Haproxy team!
>
> I've been trying to figure out how to perform automatic redirects based on
> source URL transformations.
>
> *Basically I need the following redirect: *
>
> mysite.*abc* redirected to *abc*.mysite.com .
Maybe you can reuse the solution from reg-tests dir.
47 # redirect Host: example.org / subdomain.example.org
48 http-request redirect prefix
%[req.hdr(Host),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map)] code 301
if { hdr(Host),lower,regsub(:\d+$,,),map_str(${testdir}/h00003.map) -m found }
This solution uses a map for redirect.
http://git.haproxy.org/?p=haproxy-1.9.git;a=blob;f=reg-tests/http-rules/h00003.vtc;h=55bb2687d3abe02ee74eca5283e50b039d6d162e;hb=HEAD#l47
> Note that mysite.abc is not fixed, must apply to whatever abc wants to be.
>
> *Other examples:*
> *
> *
>
> mysite.fr TO fr.mysite.com
> mysite.es TO es.mysite.com
> mysite.us TO us.mysite.com
> mysite.de TO de.mysite.com
> mysite.uk TO uk.mysite.com
>
>
> Thanks in advance!
> Joao Guimaraes
Best regards
Aleks