Opens in a new tab

X-XSS-Protection: why to remove it, and what to use instead

X-XSS-Protection switched a browser’s built-in XSS filter on or off. The filters are gone — Chrome removed its XSS Auditor in version 78, Edge and Safari followed, Firefox never had one — and in some cases the filter itself created vulnerabilities. Send 0 or nothing, and use a Content-Security-Policy.

StatusDeprecated and non-standard
ChromeFilter removed in Chrome 78 (2019)
Edge, SafariFilter removed; Firefox never had one
OWASP adviceDo not set it, or set it to 0
Replaced byContent-Security-Policy

Check X-XSS-Protection on your site

Enter a domain: we fetch its homepage and read every security header, this one first.

What it does

The header told Internet Explorer, Chrome and Safari what to do when their filter thought a page reflected a script from the URL: clean the page, or with mode=block refuse to show it. Attackers learned to use the filter itself — it could strip a harmless script and make a safe page vulnerable, and block mode leaked information across sites — which is why the browsers removed it.

In a current browser the header does nothing. In an old one, 1 can create the very vulnerability it meant to stop. That is why a scanner asking for X-XSS-Protection: 1; mode=block is out of date.

Directives and values

Directive or valueWhat it does
0Turns the filter off — the safe value if you send the header at all.
1Filter on, cleaning the page. The mode that could create vulnerabilities.
1; mode=blockFilter on, blocking the page. No effect in current browsers; could leak information in old ones.

What to send instead

X-XSS-Protection: 0

Or remove the header entirely. Protect against cross-site scripting with a Content-Security-Policy that does not allow inline scripts.

How to remove it

If you use Cloudflare, check its “Add security headers” managed transform first: it sends x-xss-protection: 1; mode=block itself.

Apache

Header always unset X-XSS-Protection
Header unset X-XSS-Protection

Both lines: Apache keeps headers in two tables, and a header from PHP can sit in either.

nginx

fastcgi_hide_header X-XSS-Protection;
proxy_hide_header X-XSS-Protection;

For a header coming from PHP-FPM or from a proxied application; remove any add_header X-XSS-Protection line too.

IIS (web.config)

<system.webServer>
  <httpProtocol>
    <customHeaders>
      <remove name="X-XSS-Protection" />
    </customHeaders>
  </httpProtocol>
</system.webServer>

Caddy

header -X-XSS-Protection

Cloudflare

Rules → Overview → Create rule → Response Header Transform Rule
Remove — header name: X-XSS-Protection

Removes every header of that name from proxied responses.

WordPress

add_action( 'send_headers', function () {
	header_remove( 'X-XSS-Protection' );
} );

Only for a header PHP itself adds; one added by the web server has to be removed there.

Common mistakes

  • Adding 1; mode=block because a checklist says so — it does nothing in current browsers.
  • Treating the header as XSS protection instead of deploying a Content-Security-Policy.

What we recommend

Remove it, or set it to 0, and put the effort into a Content-Security-Policy.

Questions

My scanner says X-XSS-Protection is missing. Should I add it?

No. The scanner is out of date: OWASP recommends not setting it, or setting it to 0. Our check does not ask for it: it treats 0 as fine and flags any other value as obsolete.

Sources

Checked on 25 September 2026 against these official sources:

Know when a header disappears

Add your domain and we scan it on a schedule — security headers, certificate, HTTPS, DNS and email — and email you when a security header is removed, a certificate changes or HTTPS stops redirecting. Free for your first domain.

Create a free account