disable CSP when env = development
This commit is contained in:
parent
ced640c24a
commit
74718d6361
1 changed files with 24 additions and 21 deletions
|
@ -7,6 +7,7 @@ const storage = require('../storage');
|
||||||
const config = require('../config');
|
const config = require('../config');
|
||||||
const pages = require('./pages');
|
const pages = require('./pages');
|
||||||
// const lang = require('fluent-langneg')
|
// const lang = require('fluent-langneg')
|
||||||
|
const IS_DEV = config.env === 'development';
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
app.use(
|
app.use(
|
||||||
|
@ -18,9 +19,10 @@ module.exports = function(app) {
|
||||||
app.use(
|
app.use(
|
||||||
helmet.hsts({
|
helmet.hsts({
|
||||||
maxAge: 31536000,
|
maxAge: 31536000,
|
||||||
force: config.env === 'production'
|
force: !IS_DEV
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
if (!IS_DEV) {
|
||||||
app.use(
|
app.use(
|
||||||
helmet.contentSecurityPolicy({
|
helmet.contentSecurityPolicy({
|
||||||
directives: {
|
directives: {
|
||||||
|
@ -41,6 +43,7 @@ module.exports = function(app) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
app.use(
|
app.use(
|
||||||
busboy({
|
busboy({
|
||||||
limits: {
|
limits: {
|
||||||
|
|
Loading…
Reference in a new issue