Prerequisites
Fastify version
5.0
Plugin version
v10.0.1
Node.js version
any
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
any
Description
These are the problematic lines:
|
const opts = Object.assign({ path: '/' }, options, { |
|
expires: new Date(1), |
|
signed: undefined, |
|
maxAge: undefined |
|
}) |
Without maxAge: 0 at least some of cookie jar implementations (for example https://www.npmjs.com/package/tough-cookie) keep actual cookie with empty value in the storage instead of deleting them (like they do when maxAge is set to zero).
Because of this flaw some users had to come up with workarounds like this.
Link to code that reproduces the bug
No response
Expected Behavior
maxAge should be set along with expires option
Prerequisites
Fastify version
5.0
Plugin version
v10.0.1
Node.js version
any
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
any
Description
These are the problematic lines:
fastify-cookie/plugin.js
Lines 42 to 46 in ccb9053
Without
maxAge: 0at least some of cookie jar implementations (for example https://www.npmjs.com/package/tough-cookie) keep actual cookie with empty value in the storage instead of deleting them (like they do whenmaxAgeis set to zero).Because of this flaw some users had to come up with workarounds like this.
Link to code that reproduces the bug
No response
Expected Behavior
maxAgeshould be set along withexpiresoption