2017-02-14 20 views

ответ

1

Вы можете добавить модули 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 
}; 
+0

У меня недостаточно голосов, чтобы проголосовать, но спасибо! – Cirakuze

+0

Рад, что это помогло. :) – MjZac

+0

SailsJS имеет приличную документацию. Эта тема обсуждается в разделе «Концепции» -> «Безопасность» по адресу http://sailsjs.com/documentation/concepts/security. –

 Смежные вопросы

  • Нет связанных вопросов^_^