// security headers

Which Security Headers Should Every Website Have?

A practical baseline of HTTP security headers every website should configure, with what each one does and why it's worth the small setup effort.

3 min readAverto

Not every security header carries equal weight, and not every site needs the full, exhaustive set correctly. But there's a practical baseline that applies broadly, regardless of what the site does — a small set of headers that meaningfully reduce common attack classes at close to zero engineering cost.

The baseline set

Strict-Transport-Security (HSTS)

Instructs browsers to only ever connect to your site over HTTPS, even if a user types http:// or clicks an old link. This prevents protocol downgrade attacks, where a connection is silently forced to unencrypted HTTP. Any site serving content over HTTPS — which should be all of them at this point — benefits from this immediately.

Content-Security-Policy (CSP)

Restricts what sources of scripts, styles, images and other resources the browser is allowed to load and execute. This is the single highest-leverage header against cross-site scripting, because even if an injection point exists elsewhere in the application, a well-configured CSP can prevent the injected script from actually executing.

CSP is also the header most likely to require actual configuration effort, since an overly restrictive policy can break legitimate functionality — it needs to be tailored to what your site actually loads, not just copy-pasted from a generic template.

X-Content-Type-Options

Set to nosniff, this prevents browsers from trying to guess content types in a way that can be exploited to execute unexpected content. Zero configuration complexity, no downside to enabling it.

X-Frame-Options / frame-ancestors

Controls whether your page can be loaded inside a frame on another site, preventing clickjacking — where a malicious site overlays your page invisibly to trick users into clicking something they didn't intend to. frame-ancestors within CSP is the more modern, flexible approach, but X-Frame-Options remains widely supported as a fallback.

Referrer-Policy

Controls how much referrer information is sent to other sites when a user navigates away from your page. A reasonable default like strict-origin-when-cross-origin limits unnecessary information leakage without breaking normal referrer-dependent functionality.

Headers worth considering, depending on context

Permissions-Policy

Controls which browser features and APIs (camera, microphone, geolocation) a page is allowed to use — useful particularly for sites that embed third-party content or want to restrict what any injected or third-party script could access.

Cross-Origin-Opener-Policy / Cross-Origin-Embedder-Policy

More specialized headers relevant primarily for sites that need process isolation guarantees, such as those handling sensitive data or requiring certain modern browser APIs. Not essential for every site, but worth understanding for applications with heightened isolation needs.

What "every website should have" actually means in practice

For most sites, HSTS, a reasonably configured CSP, X-Content-Type-Options and frame protection form a practical, high-value baseline. The remaining headers add incremental value depending on the specific application — but skipping the baseline set is a common, easily avoidable gap.

A note on configuration, not just presence

Simply having a header present isn't the same as having it configured correctly. A CSP with an overly permissive policy (allowing scripts from any source, for example) provides far less protection than a properly scoped one. Presence is a starting point; correct configuration is what actually delivers the protection.

How does Averto fit in?

Averto's scanning checks not just whether these headers are present, but whether they're configured meaningfully — flagging overly permissive policies that technically exist but don't provide real protection, alongside headers that are missing entirely.

Frequently asked questions

Is Content-Security-Policy hard to set up correctly?

It can require more effort than other headers, since an overly restrictive policy can break legitimate functionality — it needs to be tailored to your site's actual resource loading, not applied generically.

Do all these headers apply to every type of site?

The core baseline (HSTS, CSP, X-Content-Type-Options, frame protection) applies broadly. More specialized headers depend on the specific application and its needs.

Can security headers break my website?

An overly restrictive CSP in particular can block legitimate resources if not configured carefully — testing in a report-only mode before full enforcement is a common, safer rollout approach.

How do I check if my site has these headers configured?

Browser developer tools or a dedicated header-scanning tool will show current header configuration for any live 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.