Newer
Older
Alessandro Cerioni
committed
server_name _;
Alessandro Cerioni
committed
# rule redirecting to fr or en regarding the browser preferences
location = / {
rewrite_by_lua '
for lang in (ngx.var.http_accept_language .. ","):gmatch("([^,]*),") do
if string.sub(lang, 0, 2) == "en" then
ngx.redirect("/en/")
end
if string.sub(lang, 0, 2) == "fr" then
ngx.redirect("/fr/")
end
end
ngx.redirect("/en/")
';
Alessandro Cerioni
committed
}
# This is needed to allow reloading in the app when not on the base url as our app is an SPA
Alessandro Cerioni
committed
location /en {
try_files $uri$args /en/index.html;
Alessandro Cerioni
committed
location /fr {
try_files $uri$args /fr/index.html;