Skip to content

Commit

Permalink
Move X-XSS-Protection: 1 wiki page here
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanHahn committed Jan 10, 2025
1 parent 627492b commit 75ce52a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/faq/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ title: "Frequently asked questions (FAQ)"
- [How do I set a Content Security Policy nonce?]({{< ref "faq/csp-nonce-example" >}})
- [How do I set both `Content-Security-Policy` and `Content-Security-Policy-Report-Only` headers?](https://github.com/helmetjs/helmet/issues/351#issuecomment-1015498560)
- [How should I use Helmet with non-document responses?]({{< ref "faq/non-documents" >}})
- [How do I disable blocking with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-disable-blocking" >}})
- [Who made Helmet?]({{< ref "faq/contributors" >}})
15 changes: 15 additions & 0 deletions content/faq/x-xss-protection-disable-blocking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: How do I disable blocking with the X-XSS-Protection header?
---

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.

If you still need to do that, you can write your own small middleware:

```js
// NOTE: This is discouraged.
app.use((req, res, next) => {
res.setHeader("X-XSS-Protection", "1");
next();
});
```

0 comments on commit 75ce52a

Please sign in to comment.