On Tue, 8 Apr 2014 11:02:42 -0700
Marc Fournier <[email protected]> wrote:

> 
> as per the subject, has anyone done something like this?
> 
> we’re setting up two backend pools, one geared to RTL languages, one to LTR … 
> I’d like to set it up so that its transparent to the end  user, so that if 
> they come in requesting, for instance, Arabic, they get directed to the RTL 
> pool, and if they come in requesting English, they go to the LTR …
> 
> I’ve searched for examples of doing this (figure I can use req.hdr() for 
> this), but have drawn a blank … 
> 
> Before I try and  do it from scratch, just figured I’d see if I wasn’t 
> re-creating the wheel first …
> 
> Thanks ...


Hello,

I understand your need, but the header accept-language is a little bit
complicated to understand. How do you known the language required by
the browser if the accept-language header contain data like this ("ar"
is arabic, RTL language):

   ar,vi;q=0.8,fr-FR;q=0.6,fr;q=0.4,en-US;q=0.2,en;q=0.2
   vi-vn,vi;q=0.8,ar;q=0.5,en;q=0.3
   zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4,ar
   zh-TW,ar;q=0.8,ja;q=0.6,en-US;q=0.4,en;q=0.2

In second time, if you find a solution to the first issue, you can use
the acl file. This file can contain all RTL language, if the acl is
true you can send the request.

This is the file (list from wikipedia
                  http://en.wikipedia.org/wiki/Right-to-left):

mycomputer:~$ cat rtl_languages
ar
arc
bcc
bqi
ckb
dv
fa
glk
he
ku
mzn
pnb
ps
sd
ug
ur
yi

Haproxy config:

  use_backend rtl if { 
req.hdr(accept-language),<unknown-process-that-return-language> -m str -f 
rtl_languages }

Thierry

Reply via email to