fix(nginx): stop pinning HSTS — actively clear it instead
The HTTPS server block sent Strict-Transport-Security: max-age=31536000; includeSubDomains. Browsers that visited HTTPS once cached the policy and then silently upgraded the still-open HTTP dashboard's fetches and frames to https — a scheme change is cross-origin, so every /rpc/v1 call died 'No Access-Control-Allow- Origin header' while the node was perfectly healthy (framework-pt 2026-09-01: the 'Failed to fetch' storm, dashboard 'not responding', every app frame mixed-content-blocked). Plain HTTP is a supported access mode BY DESIGN on this platform: the node's certificate is optional and self-signed (Settings → Node certificate, /ca.crt flow), and setup-node-ca.sh deliberately keeps port 80 serving for devices that haven't installed the CA. So: - port 80 sends no HSTS at all (with the rationale inline) - port 443 sends max-age=0, which ACTIVELY DELETES the policy already cached by affected browsers — leaving it absent would have kept every stranded browser broken for a year tests/lifecycle/bats/nginx-hsts.bats pins all three properties at the gate: no live policy on :80, max-age=0 (never 31536000) on :443, and no long-lived pin anywhere in the deployed config.
This commit is contained in:
@@ -34,7 +34,14 @@ server {
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
# NO HSTS on this node, by design (see the HTTPS block below for the
|
||||
# active clear). The dashboard is deliberately reachable over plain
|
||||
# HTTP on LANs/mDNS names where users have not installed the node CA —
|
||||
# setup-node-ca.sh keeps port 80 serving for exactly that reason. A
|
||||
# long-cache HSTS policy upgrades an already-open HTTP page's fetches to
|
||||
# HTTPS; that scheme change is cross-origin, so every /rpc/v1 call died
|
||||
# with "No Access-Control-Allow-Origin header" while the node was
|
||||
# perfectly healthy (framework-pt, 2026-09-01: "Failed to fetch" storm).
|
||||
add_header X-DNS-Prefetch-Control "off" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://*.basemaps.cartocdn.com https://tile.openstreetmap.org; font-src 'self' data:; connect-src 'self' ws: wss: http://$host:* https:; frame-src 'self' http://$host:* https:; frame-ancestors 'self'; base-uri 'self'; form-action 'self';" always;
|
||||
|
||||
@@ -1009,7 +1016,14 @@ server {
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=()" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
# HSTS actively CLEARED (max-age=0), not set: this origin's certificate is
|
||||
# optional/self-signed and plain-HTTP access is a supported mode. Earlier
|
||||
# builds sent max-age=31536000 includeSubDomains, and browsers that had
|
||||
# visited HTTPS once kept silently upgrading the HTTP dashboard's
|
||||
# subresources afterwards — every fetch became cross-origin by scheme and
|
||||
# was CORS-blocked. max-age=0 over HTTPS deletes that cached policy;
|
||||
# never raise it on this origin unless HTTP access is retired first.
|
||||
add_header Strict-Transport-Security "max-age=0" always;
|
||||
add_header X-DNS-Prefetch-Control "off" always;
|
||||
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://*.basemaps.cartocdn.com https://tile.openstreetmap.org; font-src 'self' data:; connect-src 'self' ws: wss: http://$host:* https:; frame-src 'self' http://$host:* https:; frame-ancestors 'self'; base-uri 'self'; form-action 'self';" always;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user