Security Headers
Security headers are instructions that a web server includes in its responses to tell a visitor's browser how to behave when handling the website's content. They help protect website users by enabling built-in browser security features, such as preventing certain types of attacks or controlling what external content can load on a page. Properly configuring these headers is considered a best practice for improving the security posture of any website.
Security headers are HTTP response headers sent by a web server to instruct the client browser to enforce specific security policies when rendering and interacting with web content. Common examples include Content-Security-Policy (CSP), Strict-Transport-Security (HSTS), X-Content-Type-Options, X-Frame-Options, Referrer-Policy, and Permissions-Policy. These headers establish rules that govern browser behavior, such as restricting resource loading origins, enforcing transport-layer encryption, preventing MIME-type sniffing, and mitigating clickjacking. While security headers provide an important defense-in-depth layer, they are primarily client-side enforcement mechanisms that depend on browser support and correct configuration. They do not protect against server-side vulnerabilities and may not be effective if an attacker can control or strip response headers before they reach the client.
Why it matters
Security headers serve as a critical defense-in-depth layer for web applications by instructing browsers to activate built-in protections against common attack classes such as cross-site scripting (XSS), clickjacking, protocol downgrade attacks, and MIME-type confusion. Without these headers, browsers typically fall back to permissive default behaviors, leaving users exposed even when the underlying application code is otherwise secure. Because they operate at the HTTP response level, security headers can provide broad coverage across an entire site with relatively low implementation effort compared to fixing individual vulnerabilities in application logic.
Misconfigured or missing security headers are consistently flagged in vulnerability assessments and penetration tests, and their absence can signal to attackers that a site may have a weaker overall security posture. For example, the lack of a Content-Security-Policy header removes an important barrier against XSS exploitation, while the absence of Strict-Transport-Security (HSTS) leaves users vulnerable to man-in-the-middle attacks during protocol negotiation. Organizations in regulated industries or those subject to cyber insurance requirements may find that maintaining proper security header configurations is expected as part of baseline hygiene, as noted by sources such as Corvus Insurance's best-practice guidance.
It is important to recognize, however, that security headers are client-side enforcement mechanisms. They depend on browser support and correct configuration, and they do not address server-side vulnerabilities. An attacker who can control or strip response headers before they reach the client (for instance, through a misconfigured reverse proxy or CDN) can neutralize their protections entirely. As a result, security headers should be viewed as one component within a broader security strategy rather than a standalone solution.
Who it's relevant to
Inside Security Headers
Common questions
Answers to the questions practitioners most commonly ask about Security Headers.