Skip to content

Commit 75ce52a

Browse files
committed
1 parent 627492b commit 75ce52a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

content/faq/_index.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ title: "Frequently asked questions (FAQ)"
1111
- [How do I set a Content Security Policy nonce?]({{< ref "faq/csp-nonce-example" >}})
1212
- [How do I set both `Content-Security-Policy` and `Content-Security-Policy-Report-Only` headers?](https://github.com/helmetjs/helmet/issues/351#issuecomment-1015498560)
1313
- [How should I use Helmet with non-document responses?]({{< ref "faq/non-documents" >}})
14+
- [How do I disable blocking with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-disable-blocking" >}})
1415
- [Who made Helmet?]({{< ref "faq/contributors" >}})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: How do I disable blocking with the X-XSS-Protection header?
3+
---
4+
5+
Previous versions of Helmet (and the `x-xss-protection` npm package) allowed you to remove the `mode=block` directive. This functionality was removed because it is not recommended.
6+
7+
If you still need to do that, you can write your own small middleware:
8+
9+
```js
10+
// NOTE: This is discouraged.
11+
app.use((req, res, next) => {
12+
res.setHeader("X-XSS-Protection", "1");
13+
next();
14+
});
15+
```

0 commit comments

Comments
 (0)