Вы можете добавить модули 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
};
У меня недостаточно голосов, чтобы проголосовать, но спасибо! – Cirakuze
Рад, что это помогло. :) – MjZac
SailsJS имеет приличную документацию. Эта тема обсуждается в разделе «Концепции» -> «Безопасность» по адресу http://sailsjs.com/documentation/concepts/security. –