X-XSS-Protection: turn the legacy header OFF
The old anti-XSS header now introduces bugs, set it to 0
The threat
X-XSS-Protection: 1; mode=block looks protective, but itβs a deprecated header driving a long-removed browser feature. In some older browsers its filter could itself be abused to create information-leak and false-positive vulnerabilities. Modern guidance is unambiguous: turn it off and rely on a real Content-Security-Policy instead.
The exact fix
Set the header to 0 (or remove it entirely). On Netlify:
# netlify.toml
[[headers]]
for = "/*"
[headers.values]
X-XSS-Protection = "0"
Or in _headers:
/*
X-XSS-Protection: 0
Thatβs it. Your actual XSSXSSAttackCross-Site Scripting: an attack that injects attacker-controlled JavaScript into your page to steal sessions, keylog, or act as the user. A strong CSP is the primary defense. protection comes from CSPCSPHTTP headerContent-Security-Policy: a response header that whitelists exactly which scripts, styles, images and connections a page may use, so an injected payload simply has no permission to run., this header just needed to stop sending a harmful legacy value.
Verify it
curl -sI https://yourdomain.com | grep -i x-xss
Expected:
x-xss-protection: 0
Proof
A two-minute, one-line change on dev3lop.com, flipping 1; mode=block to 0, cleared the finding cleanly as part of the climb to grade A.