{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/session/issues/213","labels_url":"https://api.github.com/repos/expressjs/session/issues/213/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/session/issues/213/comments","events_url":"https://api.github.com/repos/expressjs/session/issues/213/events","html_url":"https://github.com/expressjs/session/issues/213","id":108204422,"number":213,"title":"No Cookie Generated","user":{"login":"yehudahkay","id":9964988,"avatar_url":"https://avatars.githubusercontent.com/u/9964988?v=3","gravatar_id":"","url":"https://api.github.com/users/yehudahkay","html_url":"https://github.com/yehudahkay","followers_url":"https://api.github.com/users/yehudahkay/followers","following_url":"https://api.github.com/users/yehudahkay/following{/other_user}","gists_url":"https://api.github.com/users/yehudahkay/gists{/gist_id}","starred_url":"https://api.github.com/users/yehudahkay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yehudahkay/subscriptions","organizations_url":"https://api.github.com/users/yehudahkay/orgs","repos_url":"https://api.github.com/users/yehudahkay/repos","events_url":"https://api.github.com/users/yehudahkay/events{/privacy}","received_events_url":"https://api.github.com/users/yehudahkay/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-24T20:09:37Z","updated_at":"2015-10-21T14:55:17Z","closed_at":"2015-10-06T16:32:58Z","body":"I've installed express session. I can see a new session being generated on each request but the session is not persisted. I see there is no cookie being generated. Here is my code \r\n\r\n```\r\nvar express = require('express');\r\nvar path = require('path');\r\nvar favicon = require('serve-favicon');\r\nvar logger = require('morgan');\r\nvar bodyParser = require('body-parser');\r\nvar session = require('express-session')\r\nvar test = require('./routes/test')\r\n\r\nvar app = express();\r\n\r\n// view engine setup\r\napp.set('views', path.join(__dirname, 'views'));\r\napp.set('view engine', 'jade');\r\n\r\n// uncomment after placing your favicon in /public\r\n//app.use(favicon(__dirname + '/public/favicon.ico'));\r\napp.use(logger('dev'));\r\n\r\nvar log4js = require('log4js');\r\nvar logger = log4js.getLogger();\r\nlog4js.replaceConsole();\r\n\r\napp.use(bodyParser.json({limit: '50mb'}));\r\napp.use(bodyParser.urlencoded({limit: '50mb', extended: true}));\r\napp.use(express.static(path.join(__dirname, 'public')));\r\n\r\n\r\n//CORS middleware\r\nvar allowCrossDomain = function(req, res, next) {\r\n    res.header('Access-Control-Allow-Origin', '*');\r\n\r\n    // Request methods you wish to allow\r\n    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');\r\n\r\n    // Request headers you wish to allow\r\n    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');\r\n\r\n    // Set to true if you need the website to include cookies in the requests sent\r\n    // to the API (e.g. in case you use sessions)\r\n    res.setHeader('Access-Control-Allow-Credentials', true);\r\n\r\n    next();\r\n}\r\n\r\napp.use(allowCrossDomain);\r\n\r\napp.use(function(req, res, next) {\r\n    var mysql      = require('mysql');\r\n    var connection = mysql.createConnection({\r\n      host     : '---',\r\n      user     : '---',\r\n      password : '---',\r\n      debug: true\r\n    });\r\n\r\n    connection.connect();\r\n\r\n    connection.changeUser({database: '---'});\r\n    req.connection = connection;\r\n    req.user = '---';\r\n    next();\r\n});\r\n\r\napp.use(session({\r\n    secret: 'test', \r\n    resave: false, \r\n    saveUninitialized: true}))\r\n\r\napp.use('/test', test)\r\n\r\n// catch 404 and forward to error handler\r\napp.use(function(req, res, next) {\r\n    var err = new Error('Not Found');\r\n    err.status = 404;\r\n    next(err);\r\n});\r\n\r\n// error handlers\r\n\r\n// development error handler\r\n// will print stacktrace\r\nif (app.get('env') === 'development') {\r\n    app.use(function(err, req, res, next) {\r\n        res.status(err.status || 500);\r\n        res.render('error', {\r\n            message: err.message,\r\n            error: err\r\n        });\r\n    });\r\n}\r\n\r\n// production error handler\r\n// no stacktraces leaked to user\r\napp.use(function(err, req, res, next) {\r\n    res.status(err.status || 500);\r\n    res.render('error', {\r\n        message: err.message,\r\n        error: {}\r\n    });\r\n});\r\n\r\n\r\nmodule.exports = app;\r\n```"},"comment":{"url":"https://api.github.com/repos/expressjs/session/issues/comments/149922812","html_url":"https://github.com/expressjs/session/issues/213#issuecomment-149922812","issue_url":"https://api.github.com/repos/expressjs/session/issues/213","id":149922812,"user":{"login":"jwhitmarsh","id":8026009,"avatar_url":"https://avatars.githubusercontent.com/u/8026009?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitmarsh","html_url":"https://github.com/jwhitmarsh","followers_url":"https://api.github.com/users/jwhitmarsh/followers","following_url":"https://api.github.com/users/jwhitmarsh/following{/other_user}","gists_url":"https://api.github.com/users/jwhitmarsh/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitmarsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitmarsh/subscriptions","organizations_url":"https://api.github.com/users/jwhitmarsh/orgs","repos_url":"https://api.github.com/users/jwhitmarsh/repos","events_url":"https://api.github.com/users/jwhitmarsh/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitmarsh/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T14:55:16Z","updated_at":"2015-10-21T14:55:16Z","body":"Ok thanks @yehudahkay "}}