Hello
I’d to know how to hide the X-Powered-By header with res.removeHeader(“x-powered-by”)
Because it keeps showing the X-Powered-By header even if I have the removeHeader code
Hello
I’d to know how to hide the X-Powered-By header with res.removeHeader(“x-powered-by”)
Because it keeps showing the X-Powered-By header even if I have the removeHeader code
Hey @anon65138472 according to the Express best practice docs, using app.disable('x-powered-by')
is the preferred way to handle this, but I can’t get that to work in Glitch either, so I’m still digging into this.
You can overwrite it with a custom value (or an empty string) using middleware; maybe that will be an acceptable workaround:
app.use(function (req, res, next) {
res.header('x-powered-by', 'Braaains!!!');
next();
});
That should be added immediately after your const app = express();
(or similar) code.
Hey @anon65138472 I know it’s been a while on this topic, but we published a fix for this a little while ago and I wanted to let you know - you should be able to remove the X-Powered-By
header from your Express apps now.