Skip to content
SEO-Wars

Schema and trust

Security headers: five headers that protect your visitors

Security headers protect visitors from clickjacking, sniffing and downgrade attacks. Each of five headers earns a point. Copy-paste configs inside.

Category
Schema and trust
Points available
5 pts
Effort
Medium effort

Why it matters

These headers tell the browser to use HTTPS only, refuse to be framed by other sites, not guess file types, and limit what is leaked in the referrer. They close common attack paths at almost no cost.

They also signal a well-maintained site, which matters for trust and for security scanners your customers may run.

How we measure it

We read the response headers of the final URL. One point each for: Strict-Transport-Security; Content-Security-Policy; X-Frame-Options or a CSP with frame-ancestors; X-Content-Type-Options: nosniff; Referrer-Policy.

Content-Security-Policy-Report-Only does not count, because it enforces nothing.

ResultPoints
All five present5
Each header present1
None0

How to fix it

  1. Add the headers at the web server, CDN or framework level so they apply to every page.
  2. Start CSP safely with frame-ancestors 'self'; upgrade-insecure-requests. Build a stricter policy later with Report-Only.
  3. Enable HSTS only after the whole site works on HTTPS, and start with a short max-age if unsure.

Copy-paste fixes

Servernginx.conf
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "frame-ancestors 'self'; upgrade-insecure-requests" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
Server.htaccess
<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
  Header always set Content-Security-Policy "frame-ancestors 'self'; upgrade-insecure-requests"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
WordPressfunctions.php
add_action( 'send_headers', function () {
    header( 'Strict-Transport-Security: max-age=31536000; includeSubDomains' );
    header( "Content-Security-Policy: frame-ancestors 'self'; upgrade-insecure-requests" );
    header( 'X-Frame-Options: SAMEORIGIN' );
    header( 'X-Content-Type-Options: nosniff' );
    header( 'Referrer-Policy: strict-origin-when-cross-origin' );
} );
Next.jsnext.config.ts
import type { NextConfig } from "next";

const securityHeaders = [
  { key: "Strict-Transport-Security", value: "max-age=31536000; includeSubDomains" },
  { key: "Content-Security-Policy", value: "frame-ancestors 'self'; upgrade-insecure-requests" },
  { key: "X-Frame-Options", value: "SAMEORIGIN" },
  { key: "X-Content-Type-Options", value: "nosniff" },
  { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
];

const config: NextConfig = {
  async headers() {
    return [{ source: "/:path*", headers: securityHeaders }];
  },
};

export default config;

Common mistakes

  • Adding a strict CSP in one go and breaking analytics, fonts or payments.
  • Using X-Frame-Options: DENY when you embed your own pages in iframes.
  • Setting headers in a meta tag. HSTS, X-Frame-Options and frame-ancestors only work as real HTTP headers.

Test your site now

Put your site against a competitor and see how many of these points you earn, and which fixes pay off first.

Start a duel
← All checksUpdated December 1, 2026
Security headers: why it matters and how to fix it · SEO-Wars