How do I hide X-Powered-By

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 @emilvsn 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.