你可以像添加模块lusca,并helmet在http.js和配置的顺序。
var lusca = require('lusca');
var helmet = require('helmet');
module.exports.http = {
middleware: {
order: [
'startRequestTimer',
'cookieParser',
'session',
'bodyParser',
'handleBodyParserError',
'compress',
'methodOverride',
'$custom',
'helmetProtection',
'xframe',
'router',
'www',
'favicon',
'404',
'500'
],
xframe: function xframe(req, res, next) {
return lusca.xframe('SAMEORIGIN')(req, res, next);
},
helmetProtection: function helmetProtection(req, res, next) {
return helmet({
frameguard: false
})(req, res, next);
}
},
cache: 1 * 60 * 60
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
530 次 |
| 最近记录: |