NeovaNền tảng SEO chuyên sâu

Thiếu header HSTS hoặc max-age ngắn hơn một năm

Trong Neova Chạy ngay từ lần crawl: không cần thiết lập gì.

Quy tắc được rà soát lần cuối ngày 17 tháng 10 năm 2026 · Hướng dẫn cập nhật ngày 7 tháng 7 năm 2026

Không có HSTS, trình duyệt vẫn có thể gửi yêu cầu đầu tiên qua HTTP thường, khiến yêu cầu đó có thể bị chặn bắt. max-age bằng 0 bảo trình duyệt quên quy tắc này cho host đó.

Bạn có thể làm gì

Gửi Strict-Transport-Security trên các phản hồi HTTPS. Tăng max-age theo từng bước tới tối thiểu 31536000 (1 năm), và thêm includeSubDomains khi mọi subdomain đều đã dùng HTTPS.

Neova tìm ra bằng cách nào

Neova đọc header phản hồi của mọi địa chỉ.

Vì sao Neova đánh dấu

  • Không có HSTS, trình duyệt vẫn có thể gửi request đầu tiên qua HTTP thường, có thể bị chặn bắt trước khi redirect sang HTTPS.
  • max-age bằng 0 báo trình duyệt bỏ quy tắc cho host; Lighthouse và danh sách HSTS preload yêu cầu tối thiểu 31536000 giây (1 năm).
  • Đây là quy ước bảo mật, không phải quy tắc của công cụ tìm kiếm.

Nguồn

Ticket nó tạo ra

Phần này tạm thời còn bằng tiếng Anh.

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.

Hướng dẫn đầy đủ

Phần này tạm thời còn bằng tiếng Anh.

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.

Tìm lỗi này trên trang của bạn

Neova chạy mục kiểm tra này và mọi mục khác trong mỗi lần crawl, rồi viết cách sửa thành ticket cho nhóm của bạn.

  • Ứng dụng máy tính cho Mac, Windows và Linux
  • Tất cả 696 mục kiểm tra, mỗi mục kèm nguồn
  • Search Console và Analytics 4, kết nối chỉ đọc
  • Ticket sang Jira, Linear và Asana

Tải Neova Gói Desktop Free, hoặc dùng thử Solo miễn phí 14 ngày, không cần thẻ.

Tất cả mục kiểm tra Bảo mật · Hướng dẫn · Thư viện mục kiểm tra

Do Neova Labs biên soạn · Quay lại Thư viện mục kiểm tra