If I enable the session feature of express via app.use(express.session({secret: "12345"}));
the session cookie is set when the user first hits a page.
How can I disable this behavior and decide manually when to create a cookie, for example after a successful login? I am aware that I could just construct a cookie-header manually, but I would like to stay with express.session.
static1.yourdomain.com/image/i1.jpg
will not create session. Inexpress
, you can moveapp.use(express.static(...))
up to the top of other middlewares, so cookie and session middlewares will not run for static request.