Essential HTTP Security Headers Audit: HSTS, CSP & X-Frame-Options
Before an enterprise prospect schedules a B2B demo — and before cyber-insurance underwriters or SOC 2 / ISO 27001 auditors sign off on vendor onboarding — automated external scanners like SecurityScorecard, BitSight, UpGuard, and Mozilla Observatory inspect your public domain's HTTP response headers. Deploying six lightweight response headers eliminates protocol-downgrade, clickjacking, MIME-sniffing, and cross-site scripting vectors in under ten minutes with zero runtime latency.
Why missing HTTP security headers tank enterprise B2B deals & trust scores
Most marketing websites run on separate infrastructure from core production SaaS clusters — hosted on WordPress, Webflow, Vercel, Netlify, Shopify, or cPanel Apache servers managed by growth teams rather than AppSec engineers. Yet automated third-party vendor risk management (TPRM) platforms evaluate your primary apex domain (company.com) first. When company.com lacks Strict-Transport-Security, Content-Security-Policy, and X-Content-Type-Options headers, external cyber ratings drop from an 'A' to a 'C' or 'D', stalling procurement reviews.
Beyond compliance optics, HTTP response headers provide critical defense-in-depth inside every visitor's browser. Modern supply-chain attacks (such as Magecart credit-card skimmers injected via compromised third-party CDN scripts, iframe clickjacking overlays on login pages, and SSL-stripping on public Wi-Fi) are neutralized directly by browser-enforced header directives before malicious JavaScript can exfiltrate session tokens or payment inputs.
The 6 mandatory HTTP security headers and exact production values
Start with transport canonicalization and Strict-Transport-Security (HSTS). First, configure your edge or web server so http://yourdomain.com redirects in a single HTTP 301 hop directly to https://yourdomain.com. Next, emit Strict-Transport-Security: max-age=31536000; includeSubDomains (adding ; preload only once you confirm every legacy subdomain — including internal staging or mail hosts — supports valid TLS). Pair HSTS with X-Content-Type-Options: nosniff to stop browsers from executing uploaded text/image files as executable scripts.
To defeat UI redressing (clickjacking), combine legacy X-Frame-Options: SAMEORIGIN with modern Content-Security-Policy: frame-ancestors 'self'; upgrade-insecure-requests;. Add Referrer-Policy: strict-origin-when-cross-origin so full URL paths (which may contain reset tokens or private query strings) are never leaked in Referer headers to external domains, and set a tight Permissions-Policy disabling unused hardware APIs (camera, microphone, geolocation).
# Option A: Apache / LiteSpeed (.htaccess)
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" "expr=%{HTTPS} == 'on'"
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=(), payment=(self)"
Header always set Content-Security-Policy "frame-ancestors 'self'; upgrade-insecure-requests;"
</IfModule>
# Option B: Nginx (server { ... } block over TLS 1.2/1.3)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(self)" always;
add_header Content-Security-Policy "frame-ancestors 'self'; upgrade-insecure-requests;" always;
Scan Your Website Live for /llms.txt, AI Crawlers, JSON-LD & ADA/GDPR
Enter any Shopify, WordPress, Webflow, SaaS, clinic, or corporate URL below to run a free live audit — then unlock custom pre-built llms.txt, robots.txt, Schema.org JSON-LD + printable 8-Point Compliance PDF for $19.00 USD one-time (Cakto Global USD • No Subscription).
Rolling out Content-Security-Policy (CSP) safely without breaking GTM or Stripe
Engineering teams often hesitate to deploy Content-Security-Policy because an overly restrictive script-src 'self' rule deployed straight to production will instantly break Google Tag Manager, GA4, Stripe Checkout, Intercom chat, and inline Schema.org JSON-LD blocks! Never guess CSP allowlists blind. Instead, ship your strict script-src and connect-src policy inside a Content-Security-Policy-Report-Only header first for 7 to 14 days while keeping frame-ancestors 'self'; upgrade-insecure-requests; active in the enforced header.
Note a reassuring W3C detail for SEO engineers: <script type="application/ld+json"> blocks are non-executable data blocks, meaning strict CSP script-src policies do NOT block search engines or LLMs from parsing inline Schema.org JSON-LD! For executable inline scripts (such as Consent Mode v2 initialization), prefer cryptographic per-request nonces ('nonce-...') or SHA-256 hashes over broad 'unsafe-inline' directives wherever your stack allows.
Deploying headers on Cloudflare, Vercel & Netlify (No server access needed)
What if your marketing website runs on Webflow, Squarespace, Ghost Pro, or Shopify where you cannot edit Nginx or .htaccess files? If your DNS is proxied through Cloudflare (even on the Free plan), navigate to Rules > Settings > Managed Transforms and enable 'Add security headers', or create a custom HTTP Response Header Modification Rule setting all six headers cleanly at the edge in 60 seconds.
On Vercel (vercel.json headers array) and Netlify (_headers file in public/), commit the exact same six key-value pairs directly into Git so every preview and production deployment inherits Grade-A transport hardening automatically.
Audit your domain's HSTS, security headers, ADA & AI Search posture live
Check your live production headers alongside your /llms.txt, AI crawler rules, Schema.org JSON-LD, and WCAG accessibility tags in one pass: enter your domain on /en/ for a free 5-second external scan.
Need an executive-ready compliance summary plus turnkey GEO configuration files? Unlock the full $19.00 USD one-time package via Cakto Global USD to download custom llms.txt, AI robots.txt, Organization/WebSite JSON-LD, and a printable 8-point security, privacy & accessibility audit PDF.
Technical Reference & Compliance Matrix
| HTTP Response Header | Vulnerability Mitigated | Recommended Baseline Value | Deployment Caution |
|---|---|---|---|
| Strict-Transport-Security | SSL stripping & HTTP MITM downgrade | max-age=31536000; includeSubDomains | Verify all subdomains serve valid HTTPS before includeSubDomains |
| Content-Security-Policy | XSS, Magecart skimming & framing | frame-ancestors 'self'; upgrade-insecure-requests; | Test strict script-src in Report-Only mode before enforcing |
| X-Content-Type-Options | MIME-type confusion script execution | nosniff | Ensure CSS/JS files serve accurate text/css & text/javascript MIME |
| X-Frame-Options | Legacy browser clickjacking iframes | SAMEORIGIN | Omit only on routes intentionally embedded as external widgets |
| Referrer-Policy | URL token/path leakage via Referer | strict-origin-when-cross-origin | Preserves origin attribution for analytics while stripping private paths |
| Permissions-Policy | Unauthorized mic/cam/geo API access | camera=(), microphone=(), geolocation=() | Allow payment=(self) if using Apple Pay / Payment Request API |
Primary specification references: Schema.org Structured Data • W3C WCAG 2.2 Recommendation • llmstxt.org Specification.
Get All 3 Custom Files Pre-Built for Your Domain + Printable ADA/GDPR PDF
Run our free live scanner at /en/ to detect exact gaps, then unlock ready-to-upload llms.txt, AI-friendly robots.txt, validated Schema.org JSON-LD, and an executive 8-point PDF report in one click via Cakto Global USD ($19.00 one-time) — or grab our free printable 18-point PDF checklist.
Frequently Asked Questions
In Nginx, defining any add_header directive inside a nested location {} block completely overrides and clears all add_header directives inherited from the parent server {} block! Repeat your core security headers or include a shared snippets/security-headers.conf file.
Only add '; preload' and submit to hstspreload.org once you are 100% certain every single subdomain on your apex domain will permanently support HTTPS, as browser preload removal takes months.
Zero slowdown — six response headers add roughly 320 bytes to compressed HTTP/2 or HTTP/3 response frames while HSTS actually speeds up repeat visits by eliminating initial HTTP-to-HTTPS redirect roundtrips.
Yes! Our live scanner inspects transport security headers alongside /llms.txt, robots.txt, JSON-LD, and WCAG accessibility, and lets you unlock the complete report + custom files for $19.00 USD.