-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get rid of x-powered-by header #5699
Comments
You need to set helmet before calling |
@jmcdo29 const startNestApplication = async (expressInstance: express.Express) => {
const adapter = new ExpressAdapter(expressInstance);
const app = await NestFactory.create<NestExpressApplication>(AppModule, adapter, {});
app.use(helmet());
app.disable('x-powered-by');
app.disable('X-Powered-By');
app.use(helmet.hidePoweredBy());
app.use(helmet.hsts({
maxAge: 15552000,
includeSubDomains: false,
}));
app.enableCors();
const options = new DocumentBuilder()
.setTitle('CMOR')
.setDescription('CMOR API documentation')
.setVersion('1.0')
.addServer('/api')
// .addServer('/web-scanner-dev/us-central1/api')
.addApiKey({
type: 'apiKey',
name: 'api-key',
}, 'api-key')
.build();
const document = SwaggerModule.createDocument(app, options, {
include: [ScreenAnalyzerModule],
});
await app.init();
return app;
}; |
I can't reproduce this in a local implementation. Any chance you can provide a minimum reproduction? |
@jmcdo29 sure, will create and provide |
"dependencies": {
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/platform-express": "^7.0.0",
"helmet": "^4.2.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.5.4"
},
"devDependencies": {
"@nestjs/cli": "^7.0.0",
"@nestjs/schematics": "^7.0.0",
"@nestjs/testing": "^7.0.0",
"@types/express": "^4.17.3",
"@types/jest": "26.0.10",
"@types/node": "^13.9.1",
"@types/supertest": "^2.0.8",
"@typescript-eslint/eslint-plugin": "3.9.1",
"@typescript-eslint/parser": "3.9.1",
"eslint": "7.7.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"jest": "26.4.2",
"prettier": "^1.19.1",
"supertest": "^4.0.2",
"ts-jest": "26.2.0",
"ts-loader": "^6.2.1",
"ts-node": "9.0.0",
"tsconfig-paths": "^3.9.0",
"typescript": "^3.7.4"
}, |
@jmcdo29 I am using 6.1, that could be an issue, I will try to upgrade to 7 |
Doesn't change anything. Just used a v6 server and saw no |
@jmcdo29 Please see this repo, issue is reproducible https://github.com/RezaRahmati/reproduce-x-powered-by to run:
to check: |
@RezaRahmati your minimum reproduction relies on having the If you can provide a minimum reproduction, I'll be happy to take a look again. |
@jmcdo29 you are right seems firebase functions is adding the header firebase/firebase-functions#754 Thanks for help |
Bug Report
Current behavior
x-powered-by is present to response
Input Code
Expected behavior
x-powered-by be removed
Possible Solution
Environment
The text was updated successfully, but these errors were encountered: