Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for cookie checking [feature request] #2

Open
tmorehouse opened this issue Sep 2, 2014 · 1 comment
Open

Add option for cookie checking [feature request] #2

tmorehouse opened this issue Sep 2, 2014 · 1 comment

Comments

@tmorehouse
Copy link

A handy option, besides checking the accept language header, would be also to check an optional cookie value for a language code as well.

Maybe the following optional config statement:

accept_language_cookie <name of cookie to check>

And give the value of the cookie preference over the language order given in the accept language header.

This would allow the application to override the automagic language value (by setting a cookie), in case the uise would like to choose a language other than what their browser is set to.

@giom
Copy link
Owner

giom commented Sep 2, 2014

I actually do this on my nginx configuration file:

set_from_accept_language $lang en fr de;

map $cookie_lang $header_lang {
default $cookie_lang;
"" $lang;
}

So I set $header_lang to the value of either the lang cookie or if there's no cookie to the value of my set_from_accept_language.

I'm planning to write a case a study in the next few weeks of how I use this in production together with Varnish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants