You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
703 B

  1. /**
  2. * Security Middleware
  3. *
  4. * @param {Express Request} req Express request object
  5. * @param {Express Response} res Express response object
  6. * @param {Function} next next callback function
  7. * @return {any} void
  8. */
  9. module.exports = function(req, res, next) {
  10. //-> Disable X-Powered-By
  11. app.disable('x-powered-by');
  12. //-> Disable Frame Embedding
  13. res.set('X-Frame-Options', 'deny');
  14. //-> Re-enable XSS Fitler if disabled
  15. res.set('X-XSS-Protection', '1; mode=block');
  16. //-> Disable MIME-sniffing
  17. res.set('X-Content-Type-Options', 'nosniff');
  18. //-> Disable IE Compatibility Mode
  19. res.set('X-UA-Compatible', 'IE=edge');
  20. return next();
  21. };