]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: http: Add the "language" converter to for use with accept-language
authorThierry FOURNIER <tfournier@exceliance.fr>
Fri, 11 Apr 2014 15:51:01 +0000 (17:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Apr 2014 16:39:29 +0000 (18:39 +0200)
commitad9035186e3dce0458a76c7f6eb323475ad9c57d
treebc923ade93527233b615d3500a38d254bb5e3085
parent74c219dc0494e127bf73e1fdbfd5dd7c48332c59
MINOR: http: Add the "language" converter to for use with accept-language

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 :

     # this configuration switches to the backend matching a
     # given language based on the request :

     acl de req.fhdr(accept-language),language(de;es;fr;en) de
     acl es req.fhdr(accept-language),language(de;es;fr;en) es
     acl fr req.fhdr(accept-language),language(de;es;fr;en) fr
     acl en req.fhdr(accept-language),language(de;es;fr;en) en
     use_backend german  if de
     use_backend spanish if es
     use_backend french  if fr
     use_backend english if en
     default_backend choose_your_language
doc/configuration.txt
src/proto_http.c