Free auditStart free
GlossaryGlossary · Security

Security headers

Security headers are HTTP response headers that tell browsers how to handle your site. See the main ones, example values, a rollout order and how to test them.

4 min
read
6
sources
Oct 25, 2026
updated
Scaplet Editorial Team
author
In one line

Security headers are HTTP response headers that tell a browser how to treat your site's content, such as only using HTTPS, loading scripts from approved sources or not being embedded in other sites. The OWASP Secure Headers Project describes them as headers that, once set, can restrict modern browsers from running into easily preventable vulnerabilities.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode

At a glance

4 facts from the sources below
HTTP response headers
Type
Web server, CDN or application code
Where set
The visitor's browser
Enforced by
Content-Security-Policy-Report-Only
Safest first step
01Explained

What security headers do

Your server sends a set of headers with every response. A security header is one of those lines that instructs the browser to apply a restriction. The browser enforces it for the visitor, so the protection works even if your own code has a flaw the header was designed to contain.

They are not a replacement for fixing vulnerabilities. They are a second layer. MDN's practical guides say they "cannot guarantee complete security of your website", but that following them "will make your sites significantly more secure".

03Checklist

Gotchas before you copy a config

First3
HSTS must be sent over HTTPS. Browsers ignore the header on plain HTTP. Send a permanent redirect to the https URL from HTTP, and put the header on the HTTPS response.
HSTS is sticky. If a response stops sending the header, the earlier policy stays in effect until max-age runs out. To disable it, set max-age=0 over HTTPS.
preload has requirements. MDN says max-age must be at least 31536000 (1 year) and includeSubDomains must be present.
Next2
includeSubDomains covers every subdomain. Check that all of them serve HTTPS before you add it.
CSP can break your own pages. An inline script or a third-party tag that your policy does not allow will be blocked. Start with the report-only header.
Then2
Frame control has moved. OWASP notes that the CSP frame-ancestors directive obsoletes X-Frame-Options for supporting browsers. Setting frame-ancestors 'none' is MDN's advice unless you need the site to be embeddable.
Referrer defaults exist. OWASP says modern browsers default to strict-origin-when-cross-origin, and still recommends setting the header explicitly rather than relying on browser defaults.
04How it works

How to roll them out safely

  1. 01

    See what you send now

    Run curl -sI https://yoursite.com/ and read the response headers. Check a few templates, not only the home page, and check static files and API routes too, since CSP should be set on every response.

  2. 02

    Add the low-risk headers

    X-Content-Type-Options: nosniff and an explicit Referrer-Policy rarely break anything. Confirm that every response carries a correct Content-Type first.

  3. 03

    Turn on HSTS with a short max-age

    Once the whole site works on HTTPS, send Strict-Transport-Security with a small max-age, then raise it as you gain confidence.

  4. 04

    Test CSP in report-only mode

    Send Content-Security-Policy-Report-Only with your draft policy. MDN says violations are reported but the policy is not enforced. Fix what it flags, then switch to the enforcing header.

  5. 05

    Set it where it is easiest to maintain

    Use your web server config, CDN rules or application middleware, and keep one source of truth so that a redirect rule or cached response does not drop the headers.

05Explained

Do security headers affect SEO?

None of the sources cited here describe security headers as a search ranking signal, so treat them as a security and trust measure. The indirect effects are practical. HSTS and a clean HTTPS setup avoid mixed content and redirect hops, and a bad CSP can block scripts your pages need to render, which does affect what crawlers see. Test a page in the URL Inspection tool after a CSP change.
Sources · 6

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • owasp.org
  • mozilla.org
  1. 01OWASP Secure Headers Projectowasp.org · checked 2026-10-25
  2. 02OWASP HTTP Headers Cheat Sheetcheatsheetseries.owasp.org · checked 2026-10-25
  3. 03MDN: Strict-Transport-Security headerdeveloper.mozilla.org · checked 2026-10-25
  4. 04MDN: Content Security Policy (CSP)developer.mozilla.org · checked 2026-10-25
  5. 05MDN: X-Content-Type-Options headerdeveloper.mozilla.org · checked 2026-10-25
  6. 06MDN: Practical implementation guidesdeveloper.mozilla.org · checked 2026-10-25
Questions

Asked a lot.

4 questions people ask next, answered from the sources on this page.

01What are security headers?

They are HTTP response headers that instruct the browser to apply restrictions to your site, such as only using HTTPS, limiting where scripts load from or blocking framing. OWASP's Secure Headers Project describes them as headers that can stop modern browsers running into easily preventable vulnerabilities.

02What are all the security headers used in HTTP?

The OWASP HTTP Headers Cheat Sheet covers X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Strict-Transport-Security, Content-Security-Policy, Cross-Origin-Opener-Policy, Cross-Origin-Embedder-Policy, Cross-Origin-Resource-Policy and Permissions-Policy, among others.

03Do I still need X-Frame-Options?

OWASP says the CSP frame-ancestors directive obsoletes it for supporting browsers. MDN calls frame-ancestors a more flexible replacement.

04Where do I set security headers?

In your web server configuration, your CDN or your application code. OWASP's cheat sheet shows examples for Apache, Nginx, IIS, HAProxy, PHP and Express. With Nginx, add the always option, or the header is only sent for certain status codes.

Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly