M35: harden the shared public demo

This commit is contained in:
NuklearRabbit
2026-08-10 22:32:58 +02:00
parent c7492bf6ad
commit 809ba0ddcc
9 changed files with 142 additions and 22 deletions
+31
View File
@@ -1,3 +1,6 @@
limit_req_zone $binary_remote_addr zone=demo_login:10m rate=10r/m;
limit_req_zone $binary_remote_addr zone=demo_reset:10m rate=2r/m;
server {
listen 80;
server_name _;
@@ -5,6 +8,28 @@ server {
root /usr/share/nginx/html;
index index.html;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
location = /api/v1/demo/login {
limit_req zone=demo_login burst=5 nodelay;
proxy_pass http://api:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location = /api/v1/demo/reset {
limit_req zone=demo_reset burst=1 nodelay;
proxy_pass http://api:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/ {
proxy_pass http://api:8000;
proxy_set_header Host $host;
@@ -17,6 +42,12 @@ server {
}
location / {
expires -1;
try_files $uri /index.html;
}
location ~* ^/assets/.+\.[a-fA-F0-9_-]+\.(css|js|woff2|png|svg)$ {
expires 1y;
try_files $uri =404;
}
}