In the world of web security, the X-XSS-Protection header once served as a defense mechanism against reflected cross-site scripting (XSS) attacks. However, modern browsers and industry experts now consider it deprecated and non-standard.
Different browsers implemented their own versions of this filter, causing inconsistent behavior.
In certain edge cases, this header could introduce new vulnerabilities in websites that are otherwise secure.
Strong CSP rules and other security best practices offer superior protection against XSS.
Disables the XSS filter entirely.
Enables the XSS filter; the browser attempts to sanitize suspicious code.
Blocks page rendering if an XSS attack is detected.
Sanitizes the page and sends a violation report to the specified URI (Chromium only).
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
</IfModule>
add_header X-XSS-Protection "1; mode=block";
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-XSS-Protection" value="1; mode=block" />
</customHeaders>
</httpProtocol>
</system.webServer>
Instead of using the deprecated X-XSS-Protection header, implement:
Learn about other HTTP security headers to strengthen your website's security: