X-Powered-By in Response Header even after applying helmet
See original GitHub issueCode
app.use(helmet())
app.use(
helmet.contentSecurityPolicy({
useDefaults: true,
directives: {
"script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
"script-src-attr": ["'self'"],
},
})
)
Before helmet
After helmet
Versions
Node: 14.17.0 npm: 7.16.0 helmet: 4.6.0 nodemon: 2.0.7
Anyone having a similar issue?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why is x-powered-by header showing after installing Express ...
I have an Express server running on port 8080 using webpack. I installed helmet as described in the package docs
Read more >Fasten Your Helmet.js (Part 1): Securing Your Express HTTP ...
A popular way Express apps leak information is through the X-Powered-By header. This header informs the browser which server vendor and version ...
Read more >Using Helmet to remove the X-Powered-By header - O'Reilly
Using Helmet to remove the X-Powered-By header The X-Powered-By header can give malicious actors a clue about the software stack in use, informing...
Read more >02 - Hide Potentially Dangerous Information Using helmet ...
Express adverties itself in Response Headers, in the ' x-powered-by ' field. It's generally not a good idea to give out this information...
Read more >Helmet
Helmet helps you secure your Express.js apps by setting various HTTP headers. It's not a silver bullet, but it can help!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@EvanHahn I have looked into this “issue” further and I think that I have found the problem… This didn’t appear for me only after upgrading to 4.6.0. It happened on 4.4.0 too. (Oops…)
In development I have the app (Next.js) running on one port and the API server on another. I then use a custom proxy to redirect any requests to the API server as if they were both running on the same port. Now it appears as if the proxy is responsible for setting the header… In production this doesn’t happen because this custom proxy is not used. (The routing of requests is done by the hosting infrastructure). Which made me believe initially that the header was a result of upgrading Helmet…
I haven’t checked the 4.6.0 in production yet, but I’m pretty convinced the header will not be included.
My apologies for not realizing this quicker. Thank you so much for your help.
@chiragshahklc it’s interesting that you are experiencing this issue even though you are not using a proxy… Are you using a framework like Next.js by any chance?