mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #7722, hsts deprecation warnings
This commit is contained in:
@@ -184,18 +184,16 @@ function setupExpressApp(app, callback) {
|
|||||||
saveUninitialized: nconf.get('sessionSaveUninitialized') || false,
|
saveUninitialized: nconf.get('sessionSaveUninitialized') || false,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var hsts_option = {
|
app.use(helmet());
|
||||||
maxAge: meta.config['hsts-maxage'],
|
|
||||||
includeSubdomains: !!meta.config['hsts-subdomains'],
|
|
||||||
preload: !!meta.config['hsts-preload'],
|
|
||||||
setIf: function () {
|
|
||||||
return !!meta.config['hsts-enabled'];
|
|
||||||
},
|
|
||||||
};
|
|
||||||
app.use(helmet({
|
|
||||||
hsts: hsts_option,
|
|
||||||
}));
|
|
||||||
app.use(helmet.referrerPolicy({ policy: 'strict-origin-when-cross-origin' }));
|
app.use(helmet.referrerPolicy({ policy: 'strict-origin-when-cross-origin' }));
|
||||||
|
if (meta.config['hsts-enabled']) {
|
||||||
|
app.use(helmet.hsts({
|
||||||
|
maxAge: meta.config['hsts-maxage'],
|
||||||
|
includeSubDomains: !!meta.config['hsts-subdomains'],
|
||||||
|
preload: !!meta.config['hsts-preload'],
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
app.use(middleware.addHeaders);
|
app.use(middleware.addHeaders);
|
||||||
app.use(middleware.processRender);
|
app.use(middleware.processRender);
|
||||||
auth.initialize(app, middleware);
|
auth.initialize(app, middleware);
|
||||||
|
|||||||
Reference in New Issue
Block a user