# PWA / SPA: alle unbekannten Routen auf index.html zurückführen location / { try_files $uri $uri/ /index.html; } # API-Anfragen an den Backend-Container weiterleiten location /api/ { proxy_pass http://backend:3001/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; } # Service Worker und Manifest dürfen nicht langfristig gecacht werden, # sonst bekommen installierte PWA-Nutzer nie ein Update mit. location = /sw.js { add_header Cache-Control "no-cache"; try_files $uri =404; } location = /manifest.webmanifest { add_header Cache-Control "no-cache"; default_type application/manifest+json; try_files $uri =404; } # Root-CA zum Download – Android/iOS erkennen diesen MIME-Type und bieten # beim Öffnen im Browser direkt "Zertifikat installieren" an. location = /ca.crt { add_header Cache-Control "no-cache"; default_type application/x-x509-ca-cert; try_files $uri =404; } location ~* \.(?:css|js|svg|png|jpg|jpeg|gif|ico|woff2?)$ { expires 7d; add_header Cache-Control "public, max-age=604800, immutable"; }