Files
internetforkids/nginx.conf
Christian Gick 2dfc9ed8bd
All checks were successful
Deploy Internet for Kids / Build & Push (push) Successful in 9s
Deploy Internet for Kids / Deploy (push) Successful in 6s
Deploy Internet for Kids / Health Check (push) Successful in 2s
Deploy Internet for Kids / Smoke Tests (push) Successful in 3s
Deploy Internet for Kids / Promote to Latest (push) Successful in 2s
Deploy Internet for Kids / Rollback (push) Has been skipped
Deploy Internet for Kids / Audit (push) Successful in 2s
fix: language switch losing prefix + SSL redirect scheme
Menu links used url= which doesn't prepend language prefix.
Changed to pageRef= which resolves per-language correctly.

Also fixed root redirect using http:// instead of https://
by reading X-Forwarded-Proto from gateway proxy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 11:08:36 +03:00

55 lines
1.5 KiB
Nginx Configuration File

map $http_x_forwarded_proto $real_scheme {
default $scheme;
https https;
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Security headers
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-XSS-Protection "1; mode=block" always;
# Gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
gzip_min_length 256;
# Cache static assets
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires 30d;
add_header Cache-Control "public, immutable";
}
# Cache HTML with short TTL for freshness
location ~* \.html$ {
expires 1h;
add_header Cache-Control "public, must-revalidate";
}
# Health check endpoint
location /health {
access_log off;
return 200 "ok";
add_header Content-Type text/plain;
}
# Redirect unprefixed paths to /en/
location ~ "^/(?!en/|de/|fr/|css/|js/|img/|favicon|android|apple|site|llms|health|robots|index\.xml|BingSiteAuth|[0-9a-f]{32}\.txt)" {
return 302 $real_scheme://$host/en$request_uri;
}
# Clean URLs
location / {
try_files $uri $uri/ $uri.html =404;
}
# Custom 404
error_page 404 /404.html;
}