不能摆脱标题X-Powered-By:Express [英] Can't get rid of header X-Powered-By:Express
本文介绍了不能摆脱标题X-Powered-By:Express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
X-Powered-By:Express
我想知道是否有任何方法摆脱这个标题,还是不得不忍受?
解决方案
在Express> = 3.0.0rc5:
app.disable( '×供电-由');
这是一个简单的中间件,可以在早期版本的Express中删除标题:
app.use(function(req,res,next){
res.removeHeader(x-powered-by);
next();
});
I am running a server on nodejs with express. I can't seem to get rid of the header:
X-Powered-By:Express
I was wondering if there is any way to get rid of this header or do I have to live with it?
解决方案
In Express >= 3.0.0rc5:
app.disable('x-powered-by');
Here is a simple middleware that removes the header in earlier versions of Express:
app.use(function (req, res, next) {
res.removeHeader("x-powered-by");
next();
});
这篇关于不能摆脱标题X-Powered-By:Express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文