Express: can i change X-Powered-By:Express?

Created on 21 Dec 2014  路  3Comments  路  Source: expressjs/express

can i change X-Powered-By:Express?
if i can ,how can i do?

question

Most helpful comment

You can do it just by using the code:

app.use(function (req, res, next) {
  res.setHeader('X-Powered-By', 'Rainbows')
  next()
})

All 3 comments

How about this?

var express = require('express');
var app = express();

app.disable('x-powered-by');
// or
app.set('x-powered-by', '....');

You can do it just by using the code:

app.use(function (req, res, next) {
  res.setHeader('X-Powered-By', 'Rainbows')
  next()
})

You can do it just by using the code:

app.use(function (req, res, next) {
  res.setHeader('X-Powered-By', 'Rainbows')
  next()
})

Thank you @dougwilson :smile:
Now am going to set the response header as follows

app.use((req,res,next) => {
res.setHeader('X-Powered-By','php')
next();
})
Was this page helpful?
0 / 5 - 0 ratings

Related issues

despairblue picture despairblue  路  3Comments

guyisra picture guyisra  路  3Comments

ZeddYu picture ZeddYu  路  3Comments

wxs77577 picture wxs77577  路  3Comments

haider0324 picture haider0324  路  3Comments