balderdashy / balderdashy/sails

`session.cookie.maxAge = null` is not working

Open
#6,895 2 comments 0 reactions 0 assignees View on GitHub
docs helpful info or workaround inconsistency
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Node version**: 10.15.-
**sails**: ^1.2.3,
**sails-hook-orm**: ^2.1.1,
**sails-hook-sockets**: ^2.0.0,
**sails-mysql**: ^1.0.1
Development environment


According to [the Docs](https://sailsjs.com/documentation/reference/configuration/sails-config-session#?the-session-id-cookie) when I set `session.cookie.maxAge = null` then there should be no `Expires` value in the session cookie. But it is always set.

This is a portion of my config:
```
module.exports.session = {
cookie: {
secure: false,
maxAge: null
},
name: 'ps-session',
```

This is the set-cookie header I get back:
```
set-cookie: ps-session=s%3Aj7isR2EH4lxI0b9layG_pe7DuS0A08Yo.z%2F01riIxVBf%2BSpA%2F6ZtnajE96Qe2Hhe2o9YUtoi7A8s; Path=/; Expires=Tue, 19 Nov 2019 20:58:32 GMT; HttpOnly
```

Contributor guide

Open the contributing guide

Research direction

Start with the session configuration shown in the issue and compare the documented `session.cookie.maxAge = null` behavior with the returned `set-cookie` header. Trace the session-cookie handling that produces the `Expires` value and verify the behavior across the listed Sails and Node versions. Done means a null maxAge produces a session cookie without `Expires`.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.