A few suggestions. Are you sure Redis uses the same port and password in production? If you use SSL with a service like Heroku, you need to set the proxy: true in order to have Express cookies that arrive after the earlier completion of SSL.
.use(express.session({ store: new RedisStore({ port: config.redisPort, host: config.redisHost, db: config.redisDatabase, pass: config.redisPassword}), secret: 'sauce', proxy: true, cookie: { secure: true } }))
I need the following config.js file to pass Redis configuration values:
var url = require('url') var config = {}; var redisUrl; if (typeof(process.env.REDISTOGO_URL) != 'undefined') { redisUrl = url.parse(process.env.REDISTOGO_URL); } else redisUrl = url.parse('redis://:@127.0.0.1:6379/0'); config.redisProtocol = redisUrl.protocol.substr(0, redisUrl.protocol.length - 1); // Remove trailing ':' config.redisUsername = redisUrl.auth.split(':')[0]; config.redisPassword = redisUrl.auth.split(':')[1]; config.redisHost = redisUrl.hostname; config.redisPort = redisUrl.port; config.redisDatabase = redisUrl.path.substring(1); console.log('Using Redis store ' + config.redisDatabase) module.exports = config;
source share