Skip to content

Node.js based forum software built for the modern web

closes #3435

psychobunny275769a8017d
diff --git a/app.js b/app.js
index 81fa124f88..ca272c66ec 100644
--- a/app.js
+++ b/app.js
@@ -118,6 +118,7 @@ function start() {
var urlObject = url.parse(nconf.get('url'));
var relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('base_url', urlObject.protocol + '//' + urlObject.host);
+ nconf.set('secure', urlObject.protocol === 'https');
nconf.set('use_port', !!urlObject.port);
nconf.set('relative_path', relativePath);
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567);
diff --git a/src/middleware/index.js b/src/middleware/index.js
index 51f7b10d05..fedb8b55cb 100644
--- a/src/middleware/index.js
+++ b/src/middleware/index.js
@@ -57,6 +57,10 @@ module.exports = function(app) {
cookie.domain = meta.config.cookieDomain;
}
+ if (nconf.get('secure')) {
+ cookie.secure = true;
+ }
+
app.use(session({
store: db.sessionStore,
secret: nconf.get('secret'),