ci: add GitHub Pages deployment workflow for docs site Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
2.3 KiB
Plaintext
57 lines
2.3 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Security headers (server-level -- inherited by all locations unless overridden)
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "0" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
|
|
# CSP for React SPA with Tailwind CSS and Leaflet maps
|
|
# worker-src required for SRP key derivation Web Worker (Safari won't fall back to script-src)
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://*.tile.openstreetmap.org; font-src 'self'; connect-src 'self'; worker-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self';" always;
|
|
|
|
# Proxy API requests to the backend service
|
|
# The api container is reachable via Docker internal DNS as "api" on port 8000
|
|
location /api/ {
|
|
proxy_pass http://api:8000/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
# Disable buffering for streaming/SSE endpoints
|
|
proxy_buffering off;
|
|
proxy_read_timeout 300s;
|
|
# Hide nginx server-level CSP — backend sets its own CSP on API responses
|
|
proxy_hide_header Content-Security-Policy;
|
|
}
|
|
|
|
# Serve static assets with long cache headers
|
|
# Note: add_header in a location block clears parent-block headers,
|
|
# so we re-add the essential security header for static assets.
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# SPA routing: all other requests serve index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Health check endpoint for container probes
|
|
location /nginx-health {
|
|
access_log off;
|
|
return 200 "OK\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
}
|