Skip to content

express-session compatibility issues #619

@leaky

Description

@leaky

I've integrated express-session with hopes of using sessions to store user-specific data, however it seems that the session ID is not persisting at all when running the application in development mode on port 3000.

I have integrated express-session like so below:

server.use(session({
    secret: "keyboardcat",
    resave: true,
    saveUninitialized: true,
    proxy: true,
    cookie: {
        secure: false,
        maxAge: 6000000
    }
}));

server.use(function (req, res, next) {
    console.log(req.sessionID);
    next();
});

req.sessionID has a different value on every single request. If (still in development) I switch to port 5000 then the sessionID does seem to be persisting but there's no JS functionality on 5000.

I thought that browsersync could have been the issue but after running npm run build and then node build/server.js the session ID is still not persisting, it only persists on 5000 in development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions