Skip to content

How to set a custom X–Powered–By header

Evan Hahn edited this page Jun 29, 2020 · 1 revision

In Express, the X-Powered-By header is set to Express by default. Removing it has limited security benefits, as does setting it to another value. The latter was removed in a breaking change.

If you want to replicate this behavior for some reason, you can do it with a few lines of Express:

// NOTE: This offers limited security benefits.
app.use((req, res, next) => {
  res.setHeader("X-Powered-By", "Foo Bar");
  next();
});