mirror of https://github.com/Requarks/wiki.git
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
846 B
31 lines
846 B
'use strict'
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
module.exports = function (req, res, next) {
|
|
// -> Disable X-Powered-By
|
|
req.app.disable('x-powered-by')
|
|
|
|
// -> Disable Frame Embedding
|
|
res.set('X-Frame-Options', 'deny')
|
|
|
|
// -> Re-enable XSS Fitler if disabled
|
|
res.set('X-XSS-Protection', '1; mode=block')
|
|
|
|
// -> Disable MIME-sniffing
|
|
res.set('X-Content-Type-Options', 'nosniff')
|
|
|
|
// -> Disable IE Compatibility Mode
|
|
res.set('X-UA-Compatible', 'IE=edge')
|
|
|
|
// -> Disables referrer header when navigating to a different origin
|
|
res.set('Referrer-Policy', 'same-origin')
|
|
|
|
return next()
|
|
}
|