Files
bztmon-site/nginx/security-headers.conf
T
2026-06-17 19:38:05 +10:00

17 lines
1.3 KiB
Plaintext

# Shared security headers. `include`d in the server block AND in every location
# that sets its own add_header (because add_header in a location REPLACES, not
# merges, inherited headers — the classic nginx footgun).
#
# 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;
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=(), usb=(), interest-cohort=()" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Cross-Origin-Resource-Policy "same-origin" always;