express-session creates new session over https
See original GitHub issueI am using express-session with redis and as soon as I deploy the code to elastic beanstalk and use https, new session is created upon every request. If I use http then it works as expected. The problem is not with redis as I had the same issue before when I was using the memory to store the session
const app = express();
app.set('trust proxy', 1)
app.use(session({
secret: uuidv4(),
name: 'name_',
resave: false,
saveUninitialized: true,
store: new redisStore({ client: redisClient, ttl: 86400 }),
cookie: { secure: true }
}))
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Node js express-session creating new session id every time I ...
SOLUTION: To overcome this for every request we are making from frontend(browser) we have to send that cookie to backend(server). Server will ...
Read more >Express session middleware
Create a session middleware with the given options . ... both as HTTP and HTTPS, as once the cookie is set on HTTPS,...
Read more >Session Management in Node.js using ExpressJS and ...
This tutorial will help the reader develop a session based authentication system and go over how to manage sessions using Express.js and ...
Read more >Cookie and Session (II): How session works in express-session
Session is created in server when the client send a request to it for the first time. There are different ways to create...
Read more >In Express Session Every Time new session id is generated ...
I am Using expression-session and express-mysql-session for storing in database but on every ajax returns new session id.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I finally found out what was the problem 🎉 Cloudfront was not sending any cookies to my server. Such a silly mistake
Thank you for your message, the uuid is called once so I dont think that is the problem and I think If that was the issue, http would also be broken. I did some more digging and it seems like I have the exact same problem as renehauck (https://github.com/expressjs/session/issues/652). However, in my case I do receive “x-forwarded-proto”: “https”