Trying to serve different errordoc according to the browser's language


#1

hi folks

I need to deal a different errordoc according to the browser’s language, so according to the official 1.5 doc, i came up with this :

acl fr req.fhdr(accept-language),language(fr;en) -m str fr
acl en req.fhdr(accept-language),language(fr;en) -m str en
errorfile 503 /home/wwwroot/www/ErrorDocuments/fr/maintenanceFR.html if fr
errorfile 503 /home/wwwroot/www/ErrorDocuments/fr/maintenanceEN.html if en

my headers are the following :
fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3

the problem is that both acls are matched and I can’t figure out why.
The consequence is that only the second page is served no matter what.

anyone has an idea ?

edit : Okay, i seem to have figured it out. Errorfile doesn’t seem to do well
with acls. Using “use_backend” and putting the right errorfile in the
backend section did the trick. Although, i don’t know why "errorfile"
accepts acls if it doesn’t do well with it.

edit 2 : I didn’t know that acls could only be used on several
directives, the ones that include a at the end of the usage.
use_backend has it, errorfile doesn’t. Although i’m not having any
erorrs given by the restart/check syntax.