X-XSS-Protection Header Explained

What the HTTP X-XSS-Protection header does and when it's used.

Published October 16, 2026

X-XSS-Protection controlled the legacy XSS auditor in old browsers. It is deprecated and removed; modern advice is X-XSS-Protection: 0 together with a strong CSP.

How it works

The auditor itself could introduce vulnerabilities.

The X-XSS-Protection header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
X-XSS-Protection: 0
Where X-XSS-Protection appears.

Practical examples

The header

X-XSS-Protection: 0

Set or use it in code

add_header X-XSS-Protection "0" always;

Inspect it

curl -sI https://example.com | grep -i 'x-xss-protection'

Common mistakes

  • Setting 1; mode=block and expecting protection
  • Relying on it instead of escaping output
  • Skipping CSP

Key takeaways

  • X-XSS-Protection: X-XSS-Protection controlled the legacy XSS auditor in old browsers.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

Should I use it?

No; disable it and rely on CSP and output escaping.

Is X-XSS-Protection case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles