Skip to content

Instantly share code, notes, and snippets.

@skynet
Forked from meineerde/nginx.conf
Last active August 29, 2015 05:35
Show Gist options
  • Save skynet/9077f54d147193677314 to your computer and use it in GitHub Desktop.
Save skynet/9077f54d147193677314 to your computer and use it in GitHub Desktop.
Check the Accept-Language Header to emulate part of Apache's content negotiation features. This is based on http://stackoverflow.com/questions/3657614/how-to-rewrite-location-in-nginx-depending-on-the-client-browsers-language
map $http_accept_language $lang {
default en;
~de de;
~en en;
}
location /foo/bar/baz/lang.js {
try_files $uri.$lang $uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment