Nest 6 and app.disable('x-powered-by')
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
With Nest 6, what is the proper way to disable the x-powered-by: Express
header? It seems like disable(...)
has been removed.
I don’t see any relevant information in the v6 documentation about this particular change.
What is the motivation / use case for changing the behavior?
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.disable('x-powered-by'); // no longer works
app.use(nocache());
await app.listen(1338);
}
bootstrap();
Environment
Nest version: 6.0.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Disable X-Powered-By in nestjs does not work
If app.disable('x-powered-by') does not work, you can try/fix it with: app. ... then specify the app type in your NestFactory.create call.
Read more >Getting rid of the X-Powered-By in Express JS Middle-ware ...
Completely removing the X-Powered-By headers ... First make sure which version of Express JS you are using right now. The reason being, different ......
Read more >next.config.js: Disabling x-powered-by
Disabling x -powered-by. By default Next.js will add the x-powered-by header. To opt-out of it, open next.config.js and disable the poweredByHeader config:
Read more >Nest × Yale Lock disconnected or offline
If you have a Nest x Yale Lock, your lock will go offline and become disconnected from Wi-Fi unless you use a Nest...
Read more >Create-vercel-http-server-handler NPM | npm.io
server/app/app.module'; export const nestApplicationOptions: ... in NestExpressApplication if ('disable' in app) app.disable('x-powered-by'); return app; };.
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 Free
Top 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
Thanks. I think the migration guide could use this information as well.
NestExpressApplication
is imported from@nestjs/platform-express
package. see https://docs.nestjs.com/first-steps#platform