Neova高级 SEO 平台

缺少 HSTS 标头,或 max-age 不足一年

在 Neova 中 直接在抓取过程中运行,无需任何设置。

规则最近审核:2026年10月17日 · 指南更新:2026年7月7日

没有 HSTS,浏览器仍可能通过普通 HTTP 发送第一个请求,使其容易被拦截。max-age 为 0 会让浏览器忘记针对该主机的规则。

您可以做什么

在 HTTPS 响应中发送 Strict-Transport-Security。分步把 max-age 提高到至少 31536000(1 年),并在每个子域名都使用 HTTPS 后添加 includeSubDomains。

Neova 如何发现

Neova 读取每个地址的响应头。

Neova 为何标记

  • 没有 HSTS 时,浏览器仍可能先通过普通 HTTP 发出第一个请求,在重定向到 HTTPS 之前就可能被截获。
  • max-age 为 0 会让浏览器删除该主机的规则;Lighthouse 和 HSTS 预加载列表要求至少 31536000 秒(1 年)。
  • 这是一项安全惯例,不是搜索引擎的规则。

来源

生成的工单

这一部分目前只有英文版。

SE-006 · HSTS Header Is Missing or Its Max-Age Is Under One Year

How to Check the Fix: 1. Run the check again in Neova
2. Spot-check sample URLs across affected templates
3. Record the re-check date and period label next to the baseline

Neova writes this ticket for every affected page group and sends it to Jira, Linear, Asana and the rest, after you approve it.

完整指南

这一部分目前只有英文版。

TL;DR: The HSTS header forces browsers to use HTTPS for your domain on every request, closing the man-in-the-middle window that a plain redirect leaves open. It's not a ranking factor, but it locks users onto your canonical HTTPS URLs. Start with a short max-age, then ramp to a year.

What a Missing HSTS Header Means

The Strict-Transport-Security (HSTS) header tells the browser to only ever connect to your domain over HTTPS — even if a user types http:// or clicks an old link — so if it's missing, that very first request still travels in the clear and can be hijacked before your redirect fires. This closes the tiny but real window that a plain HTTP-to-HTTPS redirect leaves open to a man-in-the-middle attacker.

Like most security headers, HSTS is not a direct ranking factor. Its SEO value is defensive: it locks users onto the canonical HTTPS version of every URL, which keeps your protocol signals clean and stops the kind of session-hijacking that leads to hacked-site warnings.

A Real Example and the Fix

A site that redirects to HTTPS but never sends HSTS looks fine in a browser yet returns nothing here:

$ curl -sI -A 'Mozilla/5.0' https://example.com/ | grep -i strict-transport
# (no output — header absent)

The fix is one header. This is the exact value GitHub ships in production — a full year, all subdomains, preload-eligible:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Re-check after deploy and the header comes back:

$ curl -sI -A 'Mozilla/5.0' https://example.com/ | grep -i strict-transport
strict-transport-security: max-age=31536000; includeSubDomains; preload

What Each HSTS Directive Does

Token Meaning Recommendation
max-age=31536000 How long (seconds) the browser remembers to force HTTPS 1 year once you're confident
includeSubDomains Applies the rule to every subdomain too Add only after confirming all subdomains do HTTPS
preload Opts into the browser-baked preload list Add last; submission is one-way and slow to reverse
max-age=0 Tells the browser to forget the policy Emergency kill-switch only

Why HSTS Closes a Gap Plain Redirects Can't

Say a user on cafe Wi-Fi types yourdomain.com. The browser fires http://yourdomain.com, your server answers with a 301 to HTTPS, and everything looks secure from there. But that first HTTP request — and the redirect response — travelled in the clear, and anyone on that network can intercept it and rewrite the redirect to a look-alike phishing host. HSTS shuts this down: once a browser has seen your header, it upgrades to HTTPS before sending anything, so that first plaintext request never happens again. The preload list goes one step further, baking the rule into the browser so even the very first visit is protected. This is the whole reason HSTS exists on top of a redirect — not redundancy, but covering the one moment the redirect can't.

How to Detect It

  1. curl: curl -sI -A 'Mozilla/5.0' https://yourdomain.com/ | grep -i strict-transport-security. Silence means it's missing.
  2. securityheaders.com: the scan lists HSTS presence, the max-age value, and whether includeSubDomains and preload are set.
  3. hstspreload.org: Google's official checker tells you whether your header qualifies for the preload list and why not if it doesn't.
  4. Screaming Frog: the Security tab flags "Missing HSTS Header" across every crawled URL in one pass.

How to Fix It

Send the header only over HTTPS — never on the plain-HTTP response, per the spec. Start with a short max-age, confirm nothing breaks, then ramp up.

Apache (.htaccess)

<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
</IfModule>

Nginx

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

Place this inside the server block that listens on 443, not the port-80 block.

WordPress (No Server Access)

Send it from PHP when you can't reach the server config:

add_action('send_headers', function () {
  if (is_ssl()) {
    header('Strict-Transport-Security: max-age=31536000; includeSubDomains');
  }
});

The is_ssl() guard keeps the header off any plain-HTTP response, which the spec requires.

The Safe Ramp

Ship max-age=300 first (five minutes). Browse the whole site, check subdomains, watch for anything that still needs plain HTTP. Bump to max-age=86400, then to a year, then — and only then — add preload and submit to hstspreload.org. Set includeSubDomains; preload with a subdomain that isn't HTTPS-ready and you'll hard-block it in every browser, with a slow, painful path to undo it.

Common Mistakes

  • Sending HSTS over HTTP. Browsers ignore the header on plain-HTTP responses by design — it only counts over HTTPS. Gate it behind an HTTPS check.
  • Jumping straight to a one-year max-age with preload. If one asset or subdomain still needs HTTP, you've locked users out with no quick undo.
  • Adding includeSubDomains before auditing subdomains. A legacy blog. or shop. subdomain on HTTP will break the moment the directive lands.
  • Forgetting the redirect. HSTS doesn't replace the 301 from HTTP to HTTPS — it complements it. Drop the redirect and first-time visitors have nothing to upgrade from.

FAQ

Is HSTS a Google Ranking Factor?

No. Google confirmed years ago that HTTPS is a lightweight signal, but HSTS specifically is not scored. You add it for security and clean protocol handling, not for a rankings bump.

Do I Still Need HTTP-to-HTTPS Redirects If I Have HSTS?

Yes. The redirect handles the very first visit before the browser has ever seen your HSTS header; HSTS protects every visit after that. Keep both — see HTTP does not redirect to HTTPS.

What's the Difference Between HSTS and CSP?

HSTS forces the connection to stay encrypted; Content-Security-Policy controls what content is allowed to load over it. Different jobs, and you want both.

Should I Add preload Right Away?

No. Preload bakes your domain into browsers and is deliberately hard to reverse. Run a long max-age with includeSubDomains in production for weeks first, confirm every subdomain is HTTPS-only, then submit.

Will HSTS Help My HTTPS Migration?

It's the finishing move, not the opener. Complete the migration, verify canonicals and redirects, then lock it in with HSTS. Our HTTPS migration checklist covers the full sequence.

在您自己的网站上找到它

Neova 在每次抓取时都会运行此检查项和其他所有检查项,然后把修复方法写成工单交给您的团队。

  • 适用于 Mac、Windows 和 Linux 的桌面应用
  • 全部 696 项检查,每项都附来源
  • Search Console 和 Analytics 4,以只读方式连接
  • 工单发送到 Jira、Linear 和 Asana

下载 Neova Desktop Free 套餐,或免费试用 Solo 14 天,无需银行卡。

全部安全检查 · 指南 · 检查项库

作者:Neova Labs · 返回检查项库