Security headers that improve both SEO and trust
Six response headers decide how a browser treats your pages: whether they always load over HTTPS, whether an injected script runs, whether another site can put you in a frame. No header is a ranking factor by name. Each one protects something your rankings and your visitors' trust rest on. This guide gives the values to set, what each does for search, and a way to audit yours in a minute.
By Théophile Louvart, founder of Porteur · Updated 16 November 2026 · Markdown
What Google counts, and what it does not
Start with the facts. Google announced HTTPS as a ranking signal in August 2014 and called it "a very lightweight signal". Its page experience guidance still asks "Are your pages served in a secure fashion?", and adds that aspects beyond Core Web Vitals do not directly help a page rank higher. No header will move a page up on its own.
What headers do is protect the ground your rankings stand on. There are three routes from a header to your search traffic.
- They keep HTTPS whole. Google prefers the HTTPS version of a page as canonical unless it finds conflicting signals, and it names insecure dependencies and redirects through HTTP among them. HSTS and one CSP directive remove both.
- They stop the injection that gets a site treated as hacked. Google's spam policies class hacked content as spam, and a site that carries it can rank lower or leave the results. A Content-Security-Policy keeps an injected script from running.
- They are read by the people and tools that decide whether to trust you. Browsers, Lighthouse, a buyer's security team and automated scanners all read your headers before they read your copy.
The six headers, and the value to start with
| Header | What it stops | Value to start with |
|---|---|---|
| Strict-Transport-Security | A visit that starts over plain HTTP, where it can be intercepted | max-age=31536000; includeSubDomains |
| Content-Security-Policy | Injected scripts, mixed content, framing by other sites | Report-only first, then enforced |
| X-Frame-Options | Your page loaded inside someone else's, known as clickjacking | DENY or SAMEORIGIN |
| X-Content-Type-Options | A browser guessing that an uploaded file is a script | nosniff |
| Referrer-Policy | Full URLs, with their paths and parameters, sent to other sites | strict-origin-when-cross-origin |
| Permissions-Policy | Embedded scripts asking for the camera, microphone or location | camera=(), microphone=(), geolocation=() |
Two older headers no longer belong on the list. X-XSS-Protection drove a browser filter that current browsers have removed, so leave it out. And take away the headers that announce your software and its version, such as X-Powered-By: they help nobody except the person matching your stack to a known flaw.
HSTS: the header Google names
A redirect from HTTP to HTTPS leaves one weak moment: the first request still travels in plain text, and anyone on the network path can answer it before your server does. Strict-Transport-Security closes that. Once a browser has seen the header, it goes straight to HTTPS for as long as max-age says, without asking.
For search, HSTS is the one security header Google's documentation mentions by name. Its page on canonical URLs lists three ways to make sure the HTTPS version is the one it indexes: a redirect from the HTTP page, a canonical link to the HTTPS page, and "Implement HSTS". Returning visitors also skip the redirect hop, because the browser rewrites the address itself.
Strict-Transport-Security: max-age=31536000; includeSubDomainsStart with a short max-age, such as 300 seconds, check that every subdomain answers over HTTPS, then raise it to a year. The browser preload list asks for a year at least, includeSubDomains and the preload directive, and its own site warns that inclusion "cannot easily be undone".
Content-Security-Policy: what an injected script runs into
A Content-Security-Policy tells the browser which sources a page may load scripts, styles, frames and images from. A script injected through a comment field or a hacked database row is written inline or comes from a host that is not on the list, and the browser refuses to run it.
That is the injection Google's spam policies describe under hacked content: code added to existing pages, and redirects that send some visitors to another site. A policy does not close the hole the attacker used. It limits what the hole can do to your visitors while you find it.
Two directives matter for search directly. upgrade-insecure-requests makes the browser fetch every http:// resource over HTTPS, which removes the insecure dependencies Google counts against the HTTPS version of a page. frame-ancestors says who may frame you, and replaces X-Frame-Options in current browsers.
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://analytics.example; img-src 'self' data: https:; frame-ancestors 'none'The four smaller headers
- X-Frame-Options stops another site from loading your page in a frame and laying its own buttons over yours. Send
DENYif nothing of yours is meant to be embedded, and keep it besideframe-ancestorsfor older browsers. - X-Content-Type-Options with the value
nosniffmakes the browser trust the declared type of a file. Without it, a file uploaded as an image can be run as a script on your domain. - Referrer-Policy decides what your pages tell the sites they link to.
strict-origin-when-cross-originsends your domain and holds the path back, so a reset link or an internal URL never lands in someone else's logs, and the sites you link to still see where the visit came from. - Permissions-Policy switches off the browser features you do not use. A third-party script that turns hostile cannot ask your visitors for their camera or their location under your name.
Where a visitor meets your headers
Nobody reads response headers before signing up. People meet their effects.
- Chrome has labelled every plain HTTP page "Not secure" in the address bar since version 68, in July 2018.
- In October 2025 Google announced that Chrome 154, due in October 2026, would ask for the user's permission before the first visit to any public site without HTTPS. A site where HTTPS is the only door never shows that prompt.
- A red Safe Browsing page appears when a site has been used to serve malware or phishing. The headers above make that harder to bring about.
- A company buying your product often runs a header check on your domain during its security review. A missing header becomes a question on a form before the contract is signed.
- Lighthouse reads the HSTS header in its Best Practices checks and flags one that is missing, shorter than a year, or lacking
includeSubDomains.
How to audit your headers in a minute
Read them yourself
Run
curl -sI https://yourproduct.comin a terminal, or open the Network tab of your browser's developer tools, click the first request and read the response headers. You are looking for the six names in the table above.Grade them
Paste the address into Keybrum's free security headers checker. It loads the page like a browser, grades the headers from A+ to F, and gives the exact line to add for each missing or weak one, written for Next.js, Vercel, Netlify, Cloudflare Pages or nginx.
Check more than the home page
Repeat on a deep page, an API route, a redirect, the 404 page and a static file. Headers set in the framework often miss what the CDN serves by itself.
Look for the header that should not be there
While you are reading, check for
X-Robots-Tag: noindex. Left over from a staging configuration, it takes pages out of Google without a word in the HTML.Audit again after each deploy
A framework upgrade, a new CDN rule or a change of host can drop a header without an error. Put the check beside your deploy, with the rest of your release checks.
What headers do not cover
A full set of headers is one layer. It tells browsers how to behave on your pages. It says nothing about a database table anyone can read, an API route that skips the session check, or a secret key shipped in your JavaScript. A site can score A+ on headers and still hand its user table to a stranger.
Those holes are found by attacking the live app. Keybrum sends 338 attacks at a deployed app and its backend settings, shows the proof for each one that worked, and attacks again after the fix until it fails. The header rules are part of that run, so the free tool and the paid attack agree. To see what a stranger's browser already receives from your app, paste the address into the free check: about ten seconds, no account.
For the configuration to paste on each host, a Content-Security-Policy written for Supabase, Stripe and analytics, and the traps that follow the obvious fix, read Keybrum's guide to security headers. The full attack is paid, from €49 for a one-time report.
Questions
Not by name. The one confirmed signal in this area is HTTPS, which Google has described as lightweight since 2014. Headers matter to search through what they protect: an HTTPS version free of conflicting signals, and pages that carry only what you wrote.
Google lists implementing HSTS among the ways to make sure the HTTPS version of a page is chosen as canonical. It also removes the redirect hop for returning visitors. It will not lift a page that ranks poorly for other reasons.
Only when it blocks something the page needs. Google renders with a current Chromium, so a policy that stops the script rendering your content can leave it with an empty page. Ship the policy in report-only mode first, then check the rendered HTML in the URL Inspection tool.
Current browsers follow the frame-ancestors directive and ignore X-Frame-Options when both are present. Sending both costs nothing and covers older browsers.
Wherever your responses are built: the headers function in next.config.js for Next.js, vercel.json on Vercel, a _headers file on Netlify and Cloudflare Pages, add_header lines in nginx. Then check that static files and error pages carry them too.
After every deploy that touches the framework, the CDN or the host, and once a quarter otherwise. Headers disappear silently, and nothing on the page tells you.
Sources
Check my site, free
Paste your URL and the free check reads your pages the way a crawler meets them, with the searches and rivals around them, in about thirty seconds, and shows three findings whole.
- Free check, no card
- Read-only, your own accounts
- Readable by your agent
Read next
- GuideMoving from HTTP to HTTPS: the checklist that keeps rankings
- GuideWeb security and SEO: why a hacked site loses rankings
- GuideWhy Google downgrades hacked sites, and how to prevent it
- Free toolServer response checker
- GuideTechnical SEO checklist for a small site
- GuideTrust signals on a product site: what a stranger checks before paying
- GlossaryHTTPS
- GuideAI-written content and Google: the policy, in Google’s words