mirror of https://github.com/requarks/wiki
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.
31 lines
744 B
31 lines
744 B
8 years ago
|
'use strict'
|
||
|
|
||
8 years ago
|
/* global app */
|
||
|
|
||
8 years ago
|
/**
|
||
|
* Security Middleware
|
||
|
*
|
||
|
* @param {Express Request} req Express request object
|
||
|
* @param {Express Response} res Express response object
|
||
|
* @param {Function} next next callback function
|
||
|
* @return {any} void
|
||
|
*/
|
||
8 years ago
|
module.exports = function (req, res, next) {
|
||
|
// -> Disable X-Powered-By
|
||
|
app.disable('x-powered-by')
|
||
8 years ago
|
|
||
8 years ago
|
// -> Disable Frame Embedding
|
||
|
res.set('X-Frame-Options', 'deny')
|
||
8 years ago
|
|
||
8 years ago
|
// -> Re-enable XSS Fitler if disabled
|
||
|
res.set('X-XSS-Protection', '1; mode=block')
|
||
8 years ago
|
|
||
8 years ago
|
// -> Disable MIME-sniffing
|
||
|
res.set('X-Content-Type-Options', 'nosniff')
|
||
8 years ago
|
|
||
8 years ago
|
// -> Disable IE Compatibility Mode
|
||
|
res.set('X-UA-Compatible', 'IE=edge')
|
||
8 years ago
|
|
||
8 years ago
|
return next()
|
||
|
}
|