]> git.example.dev Git - binbsis50.git/commitdiff
changed the configuration of the session middleware
authorLuigi Pinca <luigipinca@gmail.com>
Mon, 18 May 2015 13:27:10 +0000 (15:27 +0200)
committerLuigi Pinca <luigipinca@gmail.com>
Mon, 18 May 2015 13:27:10 +0000 (15:27 +0200)
app.js

diff --git a/app.js b/app.js
index 4b1d387f0209d25610f890c6b7294b587e723941..3d039a414009e994437ce071fa2653724b7224b0 100644 (file)
--- a/app.js
+++ b/app.js
@@ -22,6 +22,7 @@ var banHandler = require('./lib/middleware/ban-handler')
  */
 
 var app = express()
+  , production = process.env.NODE_ENV === 'production'
   , pub = __dirname + '/public' // Path to public directory
   , sessionstore = new RedisStore({client: usersdb})
   , server = http.createServer(app); // HTTP server object
@@ -34,8 +35,12 @@ app.use(banHandler);
 app.use(urlencoded({extended: false}));
 app.use(cookieParser);
 app.use(session({
-  cookie: {maxAge: 14400000}, // 4 h = 14400000 ms
-  resave: true,
+  cookie: {
+    secure: production,
+    maxAge: 14400000 // 4 h = 14400000 ms
+  },
+  proxy: production,
+  resave: false,
   rolling: true,
   saveUninitialized: true,
   secret: secret,