Send a CSP and security headers from the frontend's nginx

script-src admits the bundle and the pre-paint theme script by hash, with no
unsafe-inline or unsafe-eval; style-src keeps unsafe-inline for the <style>
elements Monaco, Radix and the toasts insert. frame-ancestors 'self',
nosniff and strict-origin-when-cross-origin go with it, and the Dockerfile
adds the API origin to connect-src when the bundle calls one elsewhere. Zod
runs jitless so its eval probe is not reported on every page. The embed
widget keeps allow-same-origin: the demo's weather map does not render
without it; the comment now says so and what it costs.
This commit is contained in:
2026-10-06 12:30:47 +02:00
parent 3758415f21
commit 4dfb1e1206
7 changed files with 48 additions and 3 deletions
+4
View File
@@ -24,6 +24,8 @@ server {
text/css
text/plain;
include /etc/nginx/security-headers.conf;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
@@ -35,6 +37,7 @@ server {
# on every reload.
location /assets/ {
root /usr/share/nginx/html;
include /etc/nginx/security-headers.conf;
add_header Cache-Control "public, max-age=31536000, immutable";
}
@@ -42,6 +45,7 @@ server {
# assets, so a stale copy pins the browser to the previous build.
location = /index.html {
root /usr/share/nginx/html;
include /etc/nginx/security-headers.conf;
add_header Cache-Control "no-cache";
}