From 164cd8eb5a7ce326127266e0c4764cbd8e719d0e Mon Sep 17 00:00:00 2001 From: MichiK <michik@michik.net> Date: Sat, 12 Dec 2020 16:55:19 +0100 Subject: [PATCH] Add URL with language detection for the angel guide --- host_vars/gabriel.c3heaven.de | 2 ++ roles/nginx-http/templates/nginx.conf.j2 | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/host_vars/gabriel.c3heaven.de b/host_vars/gabriel.c3heaven.de index 96b5576..4bf9831 100644 --- a/host_vars/gabriel.c3heaven.de +++ b/host_vars/gabriel.c3heaven.de @@ -23,6 +23,8 @@ nginx_https_sites: config: |- root /var/www/html; add_header Access-Control-Allow-Origin *; + - location: "/angelguide.pdf" + config: "rewrite .* /guide/angelguide_$lang.pdf;" - name: "www.c3heaven.de" locations: - location: "/" diff --git a/roles/nginx-http/templates/nginx.conf.j2 b/roles/nginx-http/templates/nginx.conf.j2 index 83ce97c..6d51019 100644 --- a/roles/nginx-http/templates/nginx.conf.j2 +++ b/roles/nginx-http/templates/nginx.conf.j2 @@ -34,9 +34,11 @@ http { gzip_comp_level 6; gzip_disable "msie6"; - #large_client_header_buffers 8 128k; - #http2_max_field_size 128k; - #http2_max_header_size 256k; + map $http_accept_language $lang { + default en; + "~*^((|,)\s*(?!(de|en))\w+(-\w+)?(;q=[\d\.]+)?)*(|,)\s*en\b" en; + "~*^((|,)\s*(?!(de|en))\w+(-\w+)?(;q=[\d\.]+)?)*(|,)\s*de\b" de; + } include /etc/nginx/sites-enabled/*; -- GitLab