On 27/09/2016 6:10pm, Aristedes Maniatis wrote: > I'd like to redirect subdomains in a generic way like this: > > acme.example.com -> acme.example2.com > > > I tried this: > > redirect prefix http://%[hdr(host),field(1,'.')].example2.com code 301 unless > { hdr_end(host) -i .example2.com } > > but haproxy 1.6 doesn't like the %[hdr()] notation in this location. Is there > a way to achieve this?
I think I've just discovered the trick which makes it work or break. When I have this line as just "redirect prefix..." then I get a redirect response to "http://%[hdr(x-original-site),field(1,.)].example2.com/" When I add "http-request" to the start of this line, then it works fine. I don't understand from the documentation the difference between these two directives, however from my initial tests it does seem they are different and http-request runs earlier in the processing of a response than just a bare "redirect". It would be useful if the documentation better explained the %[] operator and when it is allowed to be used. Thanks Ari -- --------------------------> Aristedes Maniatis CEO, ish https://www.ish.com.au GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
signature.asc
Description: OpenPGP digital signature

