// security headers

What Are HTTP Security Headers?

HTTP security headers instruct browsers how to handle your site defensively. Here's what they are, why they matter, and what they can't do on their own.

3 min readAverto

HTTP security headers are one of the highest-leverage, lowest-effort improvements available to most websites — a handful of response header configurations that meaningfully reduce the impact of several common attack classes, without requiring any change to application logic.

What they actually are

HTTP headers are metadata sent alongside every web response, normally used for things like content type and caching behavior. Security headers are a specific subset of these that instruct the browser how to handle the page defensively — whether to allow the page to be framed by another site, which sources of scripts and styles to trust, whether to enforce HTTPS, and more.

The critical thing to understand: security headers are enforced by the browser, not the server. The server sends the instruction; the browser is what actually acts on it. That means their effectiveness depends on browser support and correct configuration — a misconfigured or missing header simply results in the browser falling back to default (usually less restrictive) behavior.

Why they matter

Several serious and common attack classes are significantly harder to execute — or entirely prevented — when the right headers are configured correctly:

  • Cross-site scripting (XSS) — a strong Content-Security-Policy can prevent injected scripts from executing even if an injection point exists elsewhere in the application
  • Clickjacking — headers that prevent a page from being framed by another site block a common technique for tricking users into interacting with hidden content
  • Protocol downgrade attacks — headers that enforce HTTPS prevent a connection from being silently downgraded to unencrypted HTTP
  • MIME-type confusion — headers that prevent browsers from guessing content types reduce a class of attack that relies on that guessing behavior

What headers don't do

Security headers are a defense-in-depth layer, not a substitute for fixing the underlying vulnerability. A Content-Security-Policy reduces the impact of an XSS vulnerability if one exists — it doesn't prevent the underlying injection flaw from existing in the first place. Headers reduce blast radius; they don't replace secure coding practices or input validation.

It's also worth being direct about scope: security headers protect against browser-mediated attacks. They do nothing for server-side vulnerabilities like SQL injection, broken access control, or authentication flaws — those require their own, separate remediation.

The most commonly referenced headers

  • Content-Security-Policy — restricts what sources of scripts, styles and other resources the browser will load and execute
  • Strict-Transport-Security (HSTS) — instructs the browser to only ever connect over HTTPS, preventing downgrade attacks
  • X-Content-Type-Options — prevents the browser from MIME-sniffing content in a way that could be exploited
  • X-Frame-Options (and the frame-ancestors directive in CSP) — controls whether the page can be embedded in a frame on another site
  • Referrer-Policy — controls how much referrer information is sent when navigating away from the page

These are covered in more depth individually elsewhere, but the pattern across all of them is the same: each addresses a specific, well-understood attack technique, and each is close to free to implement once you understand the correct configuration.

Why headers get overlooked

Security headers don't affect visible functionality — a missing header doesn't break anything a user would notice, which means it's easy for header configuration to go unreviewed for a long time, quietly leaving a site more exposed than it needs to be. This is exactly the kind of low-visibility gap that periodic, deliberate checking closes.

How does Averto fit in?

Header configuration is one of the checks included in Averto's continuous scanning — flagged clearly, alongside guidance on correct configuration, so a quietly missing or misconfigured header doesn't sit unnoticed for months between manual reviews.

Frequently asked questions

Do security headers replace the need for secure coding?

No — they reduce the impact of certain attack classes but don't fix underlying vulnerabilities like injection flaws or broken access control.

Are security headers enforced by the server or the browser?

The server sends the header as an instruction; the browser is what actually enforces the behavior, which means browser support matters.

Is configuring security headers difficult?

Generally no — most are a matter of correct server or CDN configuration, without requiring changes to application code.

How do I check which security headers my site currently has?

Browser developer tools, or a dedicated header-checking tool, will show the headers currently returned by your site.

← All articles

// put it into practice

Scan your own application.

Averto tests your websites, web apps, code, dependencies, containers, configuration and secrets in one place, and explains every finding in plain English.