Update website configuration
systems/hermes.scm
37 | 37 | (define lepiller-policy | |
38 | 38 | (append | |
39 | 39 | web-base-policy | |
40 | - | '("set $first_language $http_accept_language;" | |
40 | + | '("# accept-language: en,en-US;q=0.8,ja;q=0.6" | |
41 | + | "set $first_language '';" | |
41 | 42 | "if ($http_accept_language ~* '(en|eo|fr)') {" | |
42 | - | " set $first_language $1;" | |
43 | + | " set $first_language $1;" | |
43 | 44 | "}" | |
44 | - | "set $language_suffix $first_language;" | |
45 | - | "if ($cookie_language) {" | |
46 | - | " set $language_suffix $cookie_language;" | |
45 | + | "if ($first_language = '') {" | |
46 | + | " set $first_language 'en';" | |
47 | 47 | "}" | |
48 | - | "if ($uri ~ \\.en.html$) {" | |
49 | - | " set $language_suffix 'en';" | |
48 | + | "set $my_uri $first_language/$uri;" | |
49 | + | "location ~ ^/[^/]*$ {" | |
50 | + | " return 301 /$first_language/$uri;" | |
50 | 51 | "}" | |
51 | - | "if ($uri ~ \\.eo.html$) {" | |
52 | - | " set $language_suffix 'eo';" | |
53 | - | "}" | |
54 | - | "if ($uri ~ \\.fr.html$) {" | |
55 | - | " set $language_suffix 'fr';" | |
56 | - | "}" | |
57 | - | "if ($uri ~ (.*).html) {" | |
58 | - | " set $my_uri $1.$language_suffix.html;" | |
59 | - | "}") | |
52 | + | ) | |
60 | 53 | (web-html-policy | |
61 | - | '(" add_header Set-Cookie 'language=$language_suffix;HttpOnly;Secure';" | |
62 | - | " try_files $my_uri $uri $uri/ =404;")) | |
63 | - | '("error_page 404 /404;"))) | |
54 | + | '(" try_files $my_uri $uri $uri/ =404;")) | |
55 | + | '("error_page 404 /404.html;"))) | |
64 | 56 | ||
65 | 57 | (operating-system | |
66 | 58 | (inherit (tyreunom-os "hermes")) | |
… | |||
116 | 108 | (listen '("80" "[::]:80")) | |
117 | 109 | (server-name '("c25o7knygjm3m67jy27yuynvv4pkfi25naucscmh4ubq2ggiig3v57ad.onion")) | |
118 | 110 | (root "/srv/http/lepiller/public") | |
119 | - | (index '("index.$language_suffix.html" "index.html")) | |
120 | - | (try-files '("$uri.$language_suffix.html" "$uri" "$uri/" "=404")) | |
111 | + | (index '("index.html")) | |
112 | + | (try-files '("$uri" "$uri/" "=404")) | |
121 | 113 | (raw-content lepiller-policy)))) | |
122 | 114 | (simple-service 'lepiller-http-server nginx-service-type | |
123 | 115 | (list (nginx-server-configuration | |
… | |||
126 | 118 | (listen '("443 ssl http2" "[::]:443 ssl http2")) | |
127 | 119 | (server-name '("lepiller.eu" "www.lepiller.eu")) | |
128 | 120 | (root "/srv/http/lepiller/public") | |
129 | - | (index '("index.$language_suffix.html" "index.html")) | |
130 | - | (try-files '("$uri.$language_suffix.html" "$uri" "$uri/" "=404")) | |
121 | + | (index '("index.html")) | |
122 | + | (try-files '("$uri" "$uri/" "=404")) | |
131 | 123 | (raw-content lepiller-policy)))) | |
132 | 124 | (simple-service 'default-http-server nginx-service-type | |
133 | 125 | (list (nginx-server-configuration |