The Four HTTP Security Headers Every Site Should Send
2026-09-02 · 6 min
When a browser loads your site, the first line of defense is not in your JavaScript - it is in a handful of response headers your server sends before any HTML arrives. Four of them matter more than the rest combined, and a surprising number of production sites - including large ones - still send none of them.
These four headers are exactly what NetChecks' HTTP Header Inspector grades, so this guide doubles as the manual for reading its verdict: what 'critical' means there, and what to do about it.
2008
nosniff appears
Internet Explorer 8 introduces the X-Content-Type-Options header to stop browsers from guessing a file's type when the server declares it wrongly - the quiet end of a whole class of content-confusion attacks.
2009
Clickjacking gets a fence
X-Frame-Options is deployed by the major browsers after clickjacking demonstrations show that invisible frames can trick users into clicking things they never saw.
2012
HSTS becomes RFC 6797
HTTP Strict Transport Security lets a site tell the browser 'never come back to this domain over plain HTTP', closing the downgrade and cookie-hijacking window that HTTPS alone left open.
2012
CSP arrives
Content Security Policy reaches version 1.0 at the W3C, giving sites an allowlist mechanism that turns reflected XSS from 'possible' into 'blocked by policy'.
Strict-Transport-Security: remember to be HTTPS
HTTPS without HSTS has a hole: the very first request a visitor makes can still be plain HTTP (a typed address, an old bookmark, a link without https), and an attacker in control of that network can answer it before the redirect to HTTPS ever happens. HSTS closes this by instructing the browser to remember - for the max-age you declare - that this domain speaks HTTPS only.
Deploy it conservatively: start with a small max-age, make sure every subdomain serves valid HTTPS before adding the includeSubDomains directive, and treat the preload directive as a one-way door - it is submitted to a public list and very hard to walk back.
The other three, in one breath
X-Content-Type-Options: nosniff stops the browser from second-guessing the Content-Type you declared - a user-uploaded file served as text cannot be reinterpreted as an executable script. X-Frame-Options: SAMEORIGIN (or its CSP grandchild frame-ancestors) forbids other sites from embedding your pages in invisible frames, which is what clickjacking needs to work.
Content-Security-Policy is the deepest of the four: a policy like script-src 'self' tells the browser which script sources are legitimate, so an attacker who manages to inject markup into your page still cannot make their payload execute. It takes the most care to deploy - start in report-only mode, watch the violations, then enforce.
Security headers travel with every response and instruct the browser before any of your code runs - which is why they must come from the server, not from the page itself.
How to adopt them without breaking anything
Add the easy two first - X-Content-Type-Options and X-Frame-Options rarely break anything - then HSTS with a short max-age, then CSP last and incrementally. A header you deploy in report-only mode gives you a violation log you can act on instead of a broken page users will report for you.
Verify each step with an inspector rather than trusting the deployment: a header set on HTML pages but not on API responses, or set only on some virtual hosts, is a gap you cannot see from the outside - except with exactly this kind of tool.
Reading a verdict like 'critical: missing headers'
When a checker reports three or four missing security headers as critical, it does not mean the site has been compromised - it means the browser is being asked to improvise where it could have been instructed. The severity reflects the size of the gap, not the certainty of an attack.
The fix is mechanical: add each header at the reverse proxy or application level, re-run the check, and watch the verdict move from critical to warning to good as the list empties. It is the highest ratio of security gained per hour spent in all of web hardening.
要点总结
Four headers, one afternoon, and an entire attack surface quietly closes. Check your own site's headers, fix what is missing, and let the browser do the rest of the work on every page load.
为防止滥用,请求会受到频率限制。此实例的运营者可以选择性地启用请求活动日志记录——如果启用,每次工具请求(您的 IP 地址、时间戳、使用的工具及输入的目标/查询内容)可能会被记录到数据库中,用于安全、防滥用和使用情况分析。此功能默认关闭。使用本网站即表示您同意上述条款;如果您不同意,请不要使用本网站。