Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

1.1 KB
Raw Blame
# =============================================================================
# AngelaMos | 2026
# security-headers.conf
# =============================================================================
# nginx inherits add_header from an outer level ONLY IF the current level
# declares none of its own. Four locations here set their own Cache-Control,
# which silently dropped every server-level security header on exactly the
# routes a browser renders: HTML pages, JS, CSS, fonts. The JSON API kept
# them, because it declares no add_header of its own. Exactly backwards.
#
# Including this in every location that sets any header of its own is the
# only construction that cannot silently regress: adding a Cache-Control to
# a new location without the include is a visible omission, not an invisible
# side effect.

add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;