On Tue, 15 Apr 2014 21:57:29 +0200
Cyril Bonté <[email protected]> wrote:
> Hi Thierry,
>
> Le 14/04/2014 21:30, Thierry FOURNIER a écrit :
> > Hi Marc,
> >
> > This dev is done in the current haproxy version. The keyword is
> > "language", this is the documentation:
> >
> > language(<value[;value[;value[;...]]]>[,<default>])
> > Returns the value with the highest q-factor from a list as
> > extracted from the "accept-language" header using "req.fhdr".
> > Values with no q-factor have a q-factor of 1. Values with a
> > q-factor of 0 are dropped. Only values which belong to the list of
> > semi-colon delimited <values> will be considered. If no value
> > matches the given list and a default value is provided, it is
> > returned. Note that language names may have a variant after a dash
> > ('-'). If this variant is present in the list, it will be matched,
> > but if it is not, only the base language is checked. The match is
> > case-sensitive, and the output string is always one of those
> > provided in arguments. The ordering of arguments is meaningless,
> > only the ordering of the values in the request counts, as the
> > first value among multiple sharing the same q-factor is used.
> >
> > Example :
> >
> > # The "language" keyword must take the list of all language that
> > # your load balanced web site support. The list of matched
> > # language must contain all RTL languages.
> > acl rtl req.fhdr(accept-language),language (de;es;fr;en;ar) ar
> > use_backend rtl if rtl default_backend ltr
>
> Shouldn't we need to provide a matching method (for example "-m str") ?
> In this case, the "language" documentation also needs to be updated.
>
you're right. If the fetch returns integer, boolean ir address, a
default match method is choosed, but if the fetch returns string or
binary no default is choosed. I don't remember the reason.
The sample configuration in the configuration is wrong, but it contains
in 80 columns :)
Thierry
>
> --
> Cyril Bonté