I am using Express and node for the session management with https. I want to create a session using express so that authentication and the session is made before the redirec
The session middleware checks if an incoming request matches the cookie path; if not, it doesn't bother continuing (and req.session
won't even be created). In your situation, your cookie path is set to /public/
, which doesn't match the request path /login
.
I think you'd want to configure the session middleware cookie to use /
as a path:
app.use(express.session({
cookie: {
path : '/',
httpOnly: false,
maxAge : 24*60*60*1000
},
secret: '1234567890QWERT'
}));