Skip to content

Commit 8b5eba6

Browse files
committed
Move custom X-Powered-By wiki page here
1 parent 5f7ca81 commit 8b5eba6

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,6 +11,7 @@ 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 set a custom `X-Powered-By` header?]({{< ref "faq/custom-x-powered-by" >}})
1415
- [How do I disable blocking with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-disable-blocking" >}})
1516
- [How do I enable the `report` directive with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-report-directive" >}})
1617
- [Who made Helmet?]({{< ref "faq/contributors" >}})

content/faq/custom-x-powered-by.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: How do I set a custom X-Powered-By header?
3+
---
4+
5+
In Express, the `X-Powered-By` header is set to `Express` by default. Removing it has limited security benefits, as does setting it to another value. The latter was removed in a breaking Helmet change.
6+
7+
If you want to replicate this behavior for some reason, you can do it with a few lines of Express:
8+
9+
```js
10+
// NOTE: This offers limited security benefits.
11+
app.use((req, res, next) => {
12+
res.setHeader("X-Powered-By", "Foo Bar");
13+
next();
14+
});
15+
```

0 commit comments

Comments
 (0)