How to Check Your Website’s Security Headers (and Which Ones Matter)

To check your website’s security headers, run curl -sSI https://yoursite.com/ (type curl.exe in Windows PowerShell). It prints the headers your server sends. Look for seven: Strict-Transport-Security (HSTS), Content-Security-Policy (CSP), X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy and Cross-Origin-Opener-Policy. If one isn’t listed, that page isn’t sending it.

Start with HSTS, nosniff, X-Frame-Options and Referrer-Policy. Then add a CSP in report-only mode, because an enforced one can break pages.

Title card: how to check your website's security headers with curl and which ones matter

Key takeaways

  • Safe for almost any site: X-Content-Type-Options: nosniff, Referrer-Policy: strict-origin-when-cross-origin and X-Frame-Options: SAMEORIGIN (unless other sites are meant to embed your pages).
  • Content-Security-Policy protects the most and breaks the most: run it as Content-Security-Policy-Report-Only first.
  • Skip X-XSS-Protection and Expect-CT. MDN marks both deprecated.
  • Big sites skip headers too: on the day I checked, wordpress.org sent only two of the seven.
Table of Contents
  1. 1Real Results: Six Sites Checked
  2. 2How to Check Your Security Headers
  3. Mac, Linux or Git Bash on Windows
  4. Windows PowerShell
  5. In the browser
  6. 3Which Security Headers Matter
  7. Headers to skip
  8. 4Start CSP in Report-Only Mode
  9. 5How to Add Security Headers
  10. Cloudflare
  11. Apache, LiteSpeed and Hostinger (.htaccess)
  12. nginx (and its inheritance trap)
  13. WordPress (plugin or code)
  14. 6Do Security Headers Affect SEO?
  15. 7Mistakes to Avoid
  16. How do I check my website’s security headers?
  17. Which security headers are most important?
  18. Should I still use X-XSS-Protection?
  19. Can a Content Security Policy break my website?
  20. Do I need both X-Frame-Options and frame-ancestors?
  21. Do security headers help SEO?

Real Results: Six Sites Checked

On 26 November 2026 I ran curl -sSI (curl 8.19.0, default user agent) from my Windows 11 PC in India against six homepages, then repeated each with a full GET request. Both rounds showed the same headers:

SiteSentNot sent
harshilbarot.comHSTS, CSP (only upgrade-insecure-requests; the full policy is report-only), nosniff, X-Frame-Options, Referrer-Policy, Permissions-PolicyCOOP
github.comHSTS (with preload), CSP, nosniff, X-Frame-Options, Referrer-PolicyPermissions-Policy, COOP
wordpress.orgHSTS (max-age=3600, one hour), X-Frame-OptionsCSP, nosniff, Referrer-Policy, Permissions-Policy, COOP
www.cloudflare.comAll seven (COOP set to unsafe-none)None
www.google.comCSP in report-only mode, X-Frame-OptionsHSTS, enforced CSP, nosniff, Referrer-Policy, Permissions-Policy, COOP
developer.mozilla.orgHSTS, CSP, nosniff, X-Frame-Options, Referrer-PolicyPermissions-Policy, COOP
curl -sSI plus a GET cross-check from Windows 11 (India), 26 November 2026; MDN checked at developer.mozilla.org/en-US/. One capture per site and method; headers can change by page and over time.
Real curl results on 26 November 2026: which of seven security headers harshilbarot.com, GitHub, wordpress.org, Cloudflare, Google and MDN send
Real readings from curl -sSI, 26 November 2026.

A missing header doesn’t make a site careless: wordpress.org and Google’s homepage lacked most of the list. Mozilla’s HTTP Observatory FAQ says an A+ grade doesn’t mean “perfectly secure”, because the scan “does not test for outdated software versions, SQL injection vulnerabilities, vulnerable content management system plugins” and more.

Only Cloudflare sent COOP, and its value unsafe-none is “the default value” (MDN), so it changes nothing. Three sites still sent the deprecated X-XSS-Protection. This site keeps its full CSP in report-only mode (the same on an article and a 404 page), so a scanner may still mark it weak.

How to Check Your Security Headers

Mac, Linux or Git Bash on Windows

curl -sSI https://yoursite.com/ | grep -iE "strict-transport|content-security|x-content-type|x-frame|referrer-policy|permissions-policy|cross-origin-opener"

-I asks for headers only (a HEAD request), -s hides the progress bar and -S still shows errors. A few servers answer a HEAD request differently from a normal page load. If the output looks wrong, load the full page and print only its headers:

curl -sS -o /dev/null -D - https://yoursite.com/ | grep -iE "strict-transport|content-security|x-content-type|x-frame|referrer-policy|permissions-policy|cross-origin-opener"

Windows PowerShell

curl.exe -sSI https://yoursite.com/ | findstr /i "strict-transport content-security x-content-type x-frame referrer-policy permissions-policy cross-origin-opener"
curl.exe -sS -o NUL -D - https://yoursite.com/ | findstr /i "strict-transport content-security x-content-type x-frame referrer-policy permissions-policy cross-origin-opener"

Type curl.exe: in Windows PowerShell 5.1, plain curl is an alias for Invoke-WebRequest. Microsoft’s docs say findstr uses spaces “to separate multiple search strings”, so it prints lines matching any word. I ran both lines with Windows’ own curl.exe 8.23.0.

In the browser

Press F12 (Cmd+Option+I on Mac), open Network, reload, click the first request and read Response Headers. Also test an article and an error page. See how to check HTTP status codes and headers for more curl options.

Security headers in priority order: add nosniff, frame protection, Referrer-Policy and HSTS first, roll out CSP in report-only mode, skip X-XSS-Protection and Expect-CT

Which Security Headers Matter

HeaderWhat it doesStarting value
Strict-Transport-SecurityHTTPS only for this sitemax-age=31536000 once HTTPS works everywhere
X-Content-Type-OptionsStops the browser guessing file types (MIME sniffing)nosniff
X-Frame-Options / frame-ancestorsStops other sites framing your pages (clickjacking)SAMEORIGIN / 'self'
Referrer-PolicyLimits the address sent to other sitesstrict-origin-when-cross-origin
Content-Security-PolicyLists where scripts, styles and frames may load fromReport-only first
Permissions-PolicyTurns off browser features you don’t usecamera=(), microphone=(), geolocation=()
Cross-Origin-Opener-PolicyIsolates your window from pages it openssame-origin, after testing pop-ups
From MDN, the OWASP HTTP Headers Cheat Sheet and W3C CSP Level 3, checked 26 November 2026.

HSTS. It tells browsers to use HTTPS only. OWASP warns to “read carefully how this header works before using it”: a long max-age plus a broken certificate can lock visitors out. My HSTS header guide covers it in depth. Also watch your SSL certificate expiry and which TLS versions your site accepts.

nosniff. It tells browsers to trust the file type your server declares instead of guessing. MDN says security testers “usually expect this header to be set”. The catch: the browser then blocks a script or stylesheet sent with the wrong Content-Type (the Fetch standard blocks a script whose type “is not a JavaScript MIME type”). After adding it, check that your scripts and CSS still load.

Frame protection. It stops other sites showing your pages inside a frame to trick clicks. OWASP says CSP frame-ancestors “obsoletes X-Frame-Options for supporting browsers”. Send both: older browsers read only X-Frame-Options.

Referrer-Policy. MDN says strict-origin-when-cross-origin is already the default, but OWASP says to “set the header explicitly rather than relying on browser defaults”.

Content-Security-Policy. A CSP lists the places your pages may load scripts, styles and frames from. MDN says it “helps guard against cross-site scripting attacks”. There are two limits. First, allowing 'unsafe-inline' “defeats much of the purpose”. Second, the strictest kind of policy tags each script with a one-time code or fingerprint (a nonce or hash), and MDN says it is “difficult to implement when you use scripts which are not under your control”. On a WordPress site, plugin, ad and analytics scripts often fall in that group.

Permissions-Policy and COOP come last. Permissions-Policy switches off browser features you don’t use, such as the camera. MDN labels it experimental, with limited browser support. COOP keeps your page in a separate browser group from other sites’ windows that it opens or is opened by. That can break sign-in and payment pop-ups, so test those first. MDN offers same-origin-allow-popups for sites that need them.

Headers to skip

  • X-XSS-Protection. MDN warns it “can create XSS vulnerabilities in otherwise safe websites”. OWASP: omit it or send 0.
  • Expect-CT. MDN: “mostly obsolete since June 2021”.
  • X-Frame-Options ALLOW-FROM. MDN says modern browsers “will ignore the header completely”.

Start CSP in Report-Only Mode

W3C CSP Level 3 describes the safe route: deploy a report-only policy, watch the reports, and move to an enforced policy “once they’ve gained confidence”. I tested the difference on a local page with one inline script in headless Chrome 158:

  • No CSP: the script ran.
  • Content-Security-Policy-Report-Only: script-src 'self': the script ran, and Chrome logged “The policy is report-only, so the violation has been logged but no further action has been taken.”
  • Content-Security-Policy: script-src 'self': the script didn’t run, and Chrome logged “The action has been blocked.”

Report-only shows what would break without breaking it. Check the DevTools Console on each page type and allow or fix each source. For server-side reports, MDN recommends report-to with a Reporting-Endpoints header. Report-only and frame-ancestors don’t work in a <meta> tag. They must be real HTTP headers.

Warning: Don’t enforce a new CSP across a live site in one step. If it blocks your analytics, fonts, embeds or a plugin’s inline script, visitors see no error message; parts of the page just stop working.

How to Add Security Headers

Cloudflare

Quick option (Managed Transforms): go to Rules → Settings → Managed Transforms and turn on Add security headers. Cloudflare’s docs say it adds nosniff, x-xss-protection: 1; mode=block, x-frame-options: SAMEORIGIN, referrer-policy: same-origin and expect-ct. OWASP says to skip two of those. The set has no CSP and no HSTS: Cloudflare’s page says to “enable HTTP Strict Transport Security (HSTS)” separately. Some Managed Transforms “may not be available in your Cloudflare plan”.

Your own values: go to Rules → Overview → Create rule → Response Header Transform Rule. Choose Set static for each header, then select Deploy.

Apache, LiteSpeed and Hostinger (.htaccess)

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
  Header always set Content-Security-Policy-Report-Only "default-src 'self'; frame-ancestors 'self'"
  # Header always set Strict-Transport-Security "max-age=31536000"
  #   (remove the # only once HTTPS works on every page and subdomain)
</IfModule>

Apache’s docs say always adds headers “even on error”. LiteSpeed says its server reads “Apache’s httpd.conf and .htaccess files”; I didn’t test each Header option on it. Hostinger’s help uses the same method (Header always set Content-Security-Policy: upgrade-insecure-requests in .htaccess) and explains how to create the file in File Manager. A typo here can cause a 500 Internal Server Error, so keep a copy of the old file. Then clear the Hostinger and LiteSpeed caches and run curl again.

nginx (and its inheritance trap)

server {
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;

    location /downloads/ {
        add_header Cache-Control "no-store";   # drops the two headers above here
    }
}

nginx’s docs say add_header directives are inherited “if and only if there are no add_header directives defined on the current level”. So one add_header inside a location drops the server-level ones there: repeat them in that location, or on nginx 1.29.3+ use add_header_inherit merge;. Without always, error pages such as 404 and 500 don’t get these headers. (From the nginx docs; not tested here.)

WordPress (plugin or code)

If you can’t edit server files, use the send_headers action, which fires once “the requested HTTP headers for caching, content type, etc. have been sent”:

<?php
/**
 * Plugin Name: Security headers
 */
add_action( 'send_headers', function () {
	header( 'X-Content-Type-Options: nosniff' );
	header( 'Referrer-Policy: strict-origin-when-cross-origin' );
	header( 'Permissions-Policy: camera=(), microphone=(), geolocation=()' );
	header( "Content-Security-Policy-Report-Only: default-src 'self'; frame-ancestors 'self'" );
} );

Save it as a PHP file in wp-content/mu-plugins; WordPress says must-use plugins there are “automatically enabled”. I checked the syntax with php -l but didn’t run it on a live site. It only covers pages WordPress builds, not images or CSS files. I couldn’t confirm that every page cache keeps these headers, so purge caches, then test with curl.

Where to add security headers: Cloudflare transform rules, Apache or LiteSpeed .htaccess, nginx add_header with its inheritance trap, WordPress send_headers

Do Security Headers Affect SEO?

Google’s page experience guide asks “Are your pages served in a secure fashion?”, but says that beyond Core Web Vitals “other page experience aspects don’t directly help your website rank higher in search results”. I found no Google statement that CSP or X-Frame-Options affect rankings. Behind a CDN, check the CDN’s responses.

Mistakes to Avoid

  • Enforcing a strict CSP on day one. Run it report-only and check every page type.
  • Trusting Cloudflare’s managed headers alone. They add no CSP or HSTS, and include two deprecated headers.
  • Setting one header in several places. Conflicting values are hard to debug.
  • One location-level add_header in nginx. It drops the server-level headers.
  • Chasing a grade. Mozilla says its Observatory doesn’t test plugins, passwords or outdated software.
Security headers checklist: run curl on three page types, add the safe headers, CSP report-only first, drop deprecated headers, retest after purging caches

Checklist in text:

  1. Run curl on your homepage, an article and a 404 page.
  2. Add nosniff, X-Frame-Options SAMEORIGIN and Referrer-Policy.
  3. Add HSTS once HTTPS works everywhere.
  4. Deploy CSP as report-only, fix what the console shows, then enforce it.
  5. Add Permissions-Policy.
  6. Remove X-XSS-Protection and Expect-CT.
  7. Purge caches and run curl again.

How do I check my website’s security headers?

Run curl -sSI https://yoursite.com/ (curl.exe in Windows PowerShell), or open DevTools, go to Network, reload and click the first request. A header that isn’t listed isn’t being sent on that page.

Which security headers are most important?

HSTS, X-Content-Type-Options: nosniff, frame protection (X-Frame-Options or frame-ancestors), Referrer-Policy and a Content-Security-Policy.

Should I still use X-XSS-Protection?

No. MDN marks it deprecated and warns it can create XSS vulnerabilities. OWASP says not to set it, or to send X-XSS-Protection: 0.

Can a Content Security Policy break my website?

Yes, an enforced one blocks anything it doesn’t allow. In my test, Chrome blocked an inline script under an enforced policy but ran it under Content-Security-Policy-Report-Only.

Do I need both X-Frame-Options and frame-ancestors?

Send both with matching values. Browsers that support CSP ignore X-Frame-Options when an enforced policy has frame-ancestors. Older browsers only read X-Frame-Options.

Do security headers help SEO?

Google hasn’t said they affect rankings. They protect your visitors.

Harshil Barot
About the author
Digital Marketing Strategist & SEO Specialist

Harshil Barot is a digital marketing strategist focused on SEO, website growth and lead generation. He has built websites since 2012 and provided digital marketing services since 2016. His reviews of web hosting, WordPress, SEO and AI tools state whether they draw on personal use, hands-on testing or editorial research.

Share

Leave a Comment