1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/middleware/helmet.js

35 lines
960 B
JavaScript
Raw Normal View History

const helmet = require('helmet');
module.exports = function(config) {
if (config.enableHelmet) {
return helmet({
2020-09-18 11:30:30 +02:00
hsts: {
maxAge: 63072000,
includeSubDomains: true,
preload: true,
},
contentSecurityPolicy: {
directives: {
defaultSrc: [
"'self'",
'fonts.googleapis.com',
'fonts.gstatic.com',
'data:',
'gravatar.com',
],
styleSrc: [
"'self'",
2020-09-07 09:51:30 +02:00
"'unsafe-inline'",
'fonts.googleapis.com',
'fonts.gstatic.com',
'data:',
],
},
},
});
}
return (req, res, next) => {
next();
};
};