From 74cbf3af26a55b6f5fc3360b303b2daca69ffe76 Mon Sep 17 00:00:00 2001 From: Jonathon Wright Date: Wed, 17 Jun 2026 19:38:05 +1000 Subject: [PATCH] Add HSTS header at the origin (host-scoped, no includeSubDomains) --- nginx/security-headers.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nginx/security-headers.conf b/nginx/security-headers.conf index e53d880..e754781 100644 --- a/nginx/security-headers.conf +++ b/nginx/security-headers.conf @@ -2,8 +2,10 @@ # that sets its own add_header (because add_header in a location REPLACES, not # merges, inherited headers — the classic nginx footgun). # -# HSTS + HTTP->HTTPS redirect are set at the Cloudflare edge (TLS terminates -# there), so they are intentionally NOT here. +# HSTS is set here at the origin (travels through the tunnel to the client) — host-scoped, +# NO includeSubDomains / preload (the *.bztmon.com wildcard points elsewhere, so forcing HTTPS +# on every subdomain would be dangerous). HTTP->HTTPS upgrade is handled by Cloudflare. +add_header Strict-Transport-Security "max-age=31536000" 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'; worker-src 'self'; manifest-src 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests" always; add_header X-Content-Type-Options "nosniff" always;