How to fix: X-XSS-Protection Header Is Deprecated
X-XSS-Protection is set to '1; mode=block'. The browser XSS auditor this header controlled has been removed from Chrome/Edge and was never supported in Firefox. The header is obsolete.
Why it matters
The header has no protective effect in modern browsers. Including it adds noise and may give false confidence that XSS is mitigated when it is not.
The X-XSS-Protection header was introduced for IE8's XSS filter and Chrome's XSS auditor. Both have been removed (Chrome 78+, Edge). The header is ignored by Firefox, Safari (post-Mojave), and all modern browsers. CSP is the correct replacement for XSS mitigation.
How to fix it
- 1Remove X-XSS-Protection from all response headers.
- 2Implement Content-Security-Policy with a restrictive script-src policy instead.
Code examples
Next.js (next.config.mjs)
export default {
async headers() {
return [{
source: '/(.*)',
headers: [
// Remove X-XSS-Protection: it is obsolete
// Use CSP instead:
{ key: 'Content-Security-Policy', value: "default-src 'self'; script-src 'self'" },
],
}];
},
};Nginx: remove X-XSS-Protection
# Remove the obsolete header
proxy_hide_header X-XSS-Protection;
# Add CSP instead:
add_header Content-Security-Policy "default-src 'self'; script-src 'self'" always;References
Detected automatically by VulnRadar. The check id is x-xss-protection-block, stable across every scan so you can filter or diff on it.
More config checks
- MediumNo Rate-Limit Policy Detected
- MediumVary: Cookie Missing on Cookie-Bearing Response
- LowSet-Cookie Header Exceeds 4 KB
- LowVary Header Missing on Compressed Responses
- InfoDownloadable Content Served as inline
- LowServer-Timing Exposes Cache Timings
- LowVary: Cookie on Static Resource
- MediumCORS Endpoint Missing Vary: Origin
Questions
- How severe is X-XSS-Protection Header Is Deprecated?
- VulnRadar rates this info severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id x-xss-protection-block, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does X-XSS-Protection Header Is Deprecated map to?
- It maps to CWE-693. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.