How to add security headers (HSTS, CSP and more)
On this page
Why this matters for SEO
Security headers instruct browsers to behave more safely. Review what is missing, add headers one at a time and test that your site still works.
Search visibility depends on several systems agreeing: the page must be reachable, discoverable, technically eligible to be indexed, useful for the query, and supported by a clear internal site structure. Fixing one symptom while another system is blocking the page can produce little or no improvement.
Use this guide as a focused workflow rather than a checklist to complete blindly. Confirm the actual page and response first, make the smallest defensible change, then re-test the same evidence after deployment.
Is this your problem?
- The Security Headers Checker reports missing headers.
- You want to harden a site after a launch.
Common causes
- Defaults of the host or CMS do not set headers.
- A header exists but is weakly configured.
Check access and HTTP status first, then robots and indexability directives, canonicalization, content/template quality, internal links and performance. This order prevents a low-priority content edit from hiding a technical blocker.
Step-by-step fix
Run the report
Enter your URL in the Security Headers Checker and note missing or weak headers.
Start with low-risk headers
Add X-Content-Type-Options: nosniff, a Referrer-Policy and a Permissions-Policy suited to your site.
Enable HSTS carefully
Set Strict-Transport-Security only when the whole site works on HTTPS, starting with a short max-age.
Roll out CSP gradually
A Content-Security-Policy can break scripts and styles. Test in report-only mode first.
Handle framing
Use frame-ancestors in CSP or X-Frame-Options to control embedding.
Re-test
Run the checker again and click through key pages and forms.
How to confirm it worked
Verification should use the same URL and comparable conditions as the original test. Check the HTTP response, rendered/source markup and the relevant Google Search Console report where applicable. A successful technical change does not guarantee immediate indexing; crawling and indexing can take time and Google may still choose not to index a page it considers redundant or low quality.
Mistakes to avoid
- Enabling a strict CSP without testing.
- Setting a long HSTS max-age before HTTPS is fully working.
Tools to use
FAQ
Where do I set headers?
In your web server configuration, CDN or application. Ask your host if unsure.
Are headers a ranking factor?
Not directly, but they improve safety and trust for visitors.
Check your own site now. The free SeOMeter tools run these checks on your own URLs, no sign-up needed.
Open the SEO toolsWas something unclear or out of date? Tell us and we will improve this guide. SEO checks are diagnostic guidance, not a promise of rankings, traffic or indexing.