Spider SEO Auditor
Security

HTTPS and security headers: what matters for SEO

HTTPS and security headers: what matters for SEO

HTTPS is a confirmed, lightweight Google ranking signal, and browsers mark plain HTTP pages as "Not secure", which drives visitors away. Security headers are not ranking factors themselves, but they protect visitors from common attacks, and a hacked site loses rankings fast. Serve every page over HTTPS, redirect HTTP to HTTPS, and add a few response headers.

What does a secure setup start with?

  1. A valid TLS certificate covering every hostname you use. Free certificates are available from Let's Encrypt and most hosts and CDNs.
  2. A permanent (301) redirect from every http:// URL to its https:// version.
  3. No mixed content: every image, script and stylesheet on an HTTPS page must also load over HTTPS.

Which headers should you add?

HeaderStarting valueProtects against
Strict-Transport-Securitymax-age=31536000; includeSubDomainsDowngrade to HTTP
Content-Security-PolicyStart with default-src 'self' and allow what you useInjected scripts (XSS)
X-Content-Type-OptionsnosniffFiles being run as the wrong type
X-Frame-Options or CSP frame-ancestorsDENY or frame-ancestors 'none'Clickjacking
Referrer-Policystrict-origin-when-cross-originLeaking full URLs to other sites
Permissions-Policycamera=(), microphone=(), geolocation=()Unwanted access to device features

How do you add them?

Headers are set by the web server, the application or the CDN, not in the HTML. In nginx they are add_header lines; in Apache, Header set; most CDNs have a rules screen for response headers. Add Content-Security-Policy last and test it carefully, because a policy that is too strict blocks your own scripts. Many sites start with Content-Security-Policy-Report-Only to see what would break.

Should you hide the server version?

Yes. Headers such as Server: Apache/2.4.41 or X-Powered-By: PHP/7.4 tell attackers exactly which known vulnerabilities to try. Remove the version numbers.

How do you check them?

Run an audit of any page to see which headers are present, or use MDN's HTTP Observatory. MDN's HTTP headers reference explains every option.

Check this on your own site

Spider's free check tests this and about 100 other things on any page, and links each problem to a guide like this one.