Can cookie-session persist?
See original GitHub issueI know this is not the good place to ask questions but this really bugs me . I cant figure out how to make cookie-session persists i set cookie-session like this:
var expiryDate = new Date(Date.now() + 24 * 60 * 60 * 1000) // 1 day
app.use(cookieSession({
name: 'sessId',
keys: ['test1', 'test2'],
cookie: {
secure: true,
httpOnly: true,
domain: constData.DOMAIN,
path: '/api',
expires: expiryDate,
maxAge: 24 * 60 * 60 * 1000
}
}))
then i set the session using:
req.session.user = 'blah';
after i close chrome browser and open up again i tried to access the session but itās appeared null. According to my understanding i can persist session if i put expires options when creating the cookie-session middleware am i right?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Express cookie-session does not persist in POST request
I'm just using the cookie-session module. Problem: The cookie is not persisting in the client. Subsequent requests from the same client show anĀ ......
Read more >Express cookie-session middleware
Simple cookie-based session middleware. A user session can be stored in two main ways with cookies: on the server or on the client....
Read more >What are cookies? What are the differences between ... - Cisco
There are two different types of cookies - session cookies and persistent cookies. If a cookie does not contain an expiration date, it...
Read more >Using HTTP cookies - MDN Web Docs
For example, cookies that persist in server-side sessions don't need to be available to JavaScript and should have the HttpOnly attribute. ThisĀ ...
Read more >Load Balancer Session Persistence - Oracle Help Center
To configure load balancer cookie session persistence, you specify: The cookie name. If you do not specify a cookie name, the default nameĀ ......
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
Also, Iām guessing you got that incorrect snippet above from https://expressjs.com/en/advanced/best-practice-security.html#set-cookie-security-options?
@bettafish15 yeh I ended up using
maxAge
too as it turns out it setsExpires
under the hood rather thanMax-Age
anyway š