Articles Security
Essential website security headers
Choose browser policies for what your site serves, embeds and sends to other origins.
Start with transport and content types
Serve the site over HTTPS and verify certificates and redirects. Strict-Transport-Security tells browsers that have received the policy over HTTPS to use HTTPS for that host on later visits. Long lifetimes, includeSubDomains and preload have wider operational consequences. Inventory affected hosts and their certificate coverage before expanding scope. Send accurate Content-Type values and use X-Content-Type-Options: nosniff to prevent MIME guessing in relevant contexts, including script and stylesheet loads.
Write a policy for your actual resources
Content-Security-Policy (CSP) controls which resources a page can use. Inventory styles, images, scripts, frame use and forms before choosing directives. For a small static site, same-origin resources and a narrow script policy may be feasible. Introduce a candidate policy in report-only mode where practical and inspect violations while exercising real pages. If reports are collected, review what they can contain and who receives them.
Control embedding and referrer detail
CSP frame-ancestors limits which parents may embed a page and must be delivered as a response header. Choose allowed parents based on actual embedding requirements. Referrer-Policy controls how much of the current URL is sent as referral information during navigation or resource requests. For example, strict-origin-when-cross-origin generally sends the origin on secure cross-origin requests and withholds referral information on HTTPS-to-HTTP downgrades.
Check the responses visitors receive
Inspect a successful HTML request, static assets, redirects and error pages through the visitor-facing endpoint. A proxy or a more specific server rule can produce different headers on different paths. Use the browser console and Network panel to diagnose blocked resources. Record the expected value and scope of each policy, then repeat the check after server or edge changes. Keep response headers alongside patching, least privilege, safe publishing and tested recovery in the wider operational review.