All checks were successful
ci / test-commons-core (push) Successful in 56s
ci / analyze (push) Successful in 1m39s
site / deploy (push) Successful in 44s
ci / test-app-seeds (push) Successful in 7m29s
release / fdroid_reference_armeabi_v7a (push) Successful in 42m36s
release / fdroid_reference_arm64_v8a (push) Successful in 33m58s
release / fdroid_reference_x86_64 (push) Successful in 26m15s
release / play (push) Successful in 12m49s
71 lines
2.8 KiB
Nginx Configuration File
71 lines
2.8 KiB
Nginx Configuration File
# Auto-detect language from the browser's Accept-Language header, no JS
|
|
# involved (site stays static/no-JS per config.toml). Only the exact "/" is
|
|
# affected — deep links (e.g. someone shares /es/legal/rules/) are untouched.
|
|
# Fires once per visitor: a "tane_visited" cookie (set on every response) is
|
|
# checked first, so a later visit to "/" — including clicking "English" from
|
|
# the switcher on a non-English browser — is never redirected again.
|
|
map $http_accept_language $tane_lang {
|
|
default en;
|
|
~*^es es;
|
|
~*^pt pt;
|
|
}
|
|
|
|
map $http_cookie $tane_seen {
|
|
default 0;
|
|
"~*tane_visited=1" 1;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Non-sensitive, no PII: only remembers "this browser has been here
|
|
# before" so the auto-redirect below doesn't repeat. No Secure flag since
|
|
# the value carries no sensitive data and this must also work over plain
|
|
# http in local/dev previews; TLS is terminated upstream in production.
|
|
add_header Set-Cookie "tane_visited=1; Path=/; Max-Age=31536000; SameSite=Lax" always;
|
|
|
|
location = / {
|
|
set $tane_redirect "";
|
|
if ($tane_seen = 0) {
|
|
set $tane_redirect $tane_lang;
|
|
}
|
|
if ($tane_redirect = en) {
|
|
set $tane_redirect "";
|
|
}
|
|
if ($tane_redirect != "") {
|
|
return 302 /$tane_redirect/;
|
|
}
|
|
try_files /index.html =404;
|
|
}
|
|
|
|
# Security headers. The page is fully static and self-contained: inline CSS
|
|
# (needs style-src 'unsafe-inline'), same-origin images (+ data: URIs), no
|
|
# third-party scripts. HSTS is host-scoped (no includeSubDomains) so it can't
|
|
# affect sibling *.comunes.org sites. TLS is terminated upstream (assange).
|
|
add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; font-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header X-Frame-Options "DENY" always;
|
|
add_header Permissions-Policy "geolocation=(), camera=(), microphone=(), interest-cohort=()" always;
|
|
add_header Strict-Transport-Security "max-age=15768000" always;
|
|
|
|
# Hugo emits directory-style URLs (/legal/privacy/index.html).
|
|
location / {
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
|
|
# Long-cache fingerprinted assets and images; the HTML stays fresh.
|
|
location ~* \.(png|jpg|jpeg|svg|webp|woff2?|css|js)$ {
|
|
expires 7d;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript image/svg+xml application/xml;
|
|
gzip_min_length 512;
|
|
}
|