How to rewrite location in nginx depending on the client-browser\'s language?
For example: My browser accept-language is \'uk,ru,en\'. When I request locati
I think it's not good idea to use nginx map $http_accept_language because
it does not honor quality value (q in Accept-Language header).
Let's imagine you have:
map $http_accept_language $lang {
default en;
~en en;
~da da;
}
And client will send Accept-Language: da, en-gb;q=0.8, en;q=0.7
Using nginx map will always map $lang to en because it simply find in header string.
But correct mapping will be $lang = da (because Danisch has quality value q=1 which is bigger then English q=0.7 in this case)
More on this in RFC: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html