Hi Cyril, thank you for you answer and proposed solution.
Best regards Andreas > -----Ursprüngliche Nachricht----- > Von: Cyril Bonté [mailto:[email protected]] > Gesendet: Freitag, 4. Dezember 2015 09:23 > An: Andreas Mock > Cc: [email protected] > Betreff: Re: Why does this config snippet fail > > Hi Andreas, > > Le 03/12/2015 12:23, Andreas Mock a écrit : > > Hi all, > > > > I'm using this snippet in the config of version 1.5.14 of haproxy: > > > > http-request redirect location https://www.domain.%[req.fhdr(accept- > language),lower,language(de-at;de-ch,de),map(/etc/haproxy/language- > map.txt,de)]/ code 301 > > > > As soon as there is NO Accept-Language-Header in the request > > the whole substitution part evaluates to '' (empty string). > > Why is this the case as I thought that the defaulting of 'language' and > 'map' > > should give a 'de'. > > > > Can someone please explain? What is the way around this? > > The converters only apply if the sample fetch matches. If no > Accept-Language header is provided, req.fhdr(accept-language) will > return "false" (no match) and none of the lower/language/map converters > will be called. > > A workaround could be to add the header before the redirect if none > exists. > > http-request set-header Accept-Language de if !{ > req.hdr(Accept-Languuage) -m found } > > > -- > Cyril Bonté

