Add the ability to configure the SameSite cookie option
martpie opened this issue ยท 4 comments
๐ Feature Proposal
On the latest Firefox releases, the following warning is issues (using via next-i18next
).
From what I see, this option is not configurable (
i18next-http-middleware/lib/languageLookups/cookie.js
Lines 78 to 83 in 5a2ee9a
Is this something that could be added? https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
Motivation
Prevent FF from breaking our website in a future release.
Example
{
cookieSameSite: 'strict'
}
in the config.
I think this should not be too hard to implement, maybe I can submit a PR for that :)
PR are always welcome ;-)
btw: serializeCookie is already prepared for this: https://github.com/i18next/i18next-http-middleware/blob/master/lib/languageLookups/cookie.js#L34
adding: if (options.cookieSameSite) cookieOptions.sameSite = options.cookieSameSite
here should do the trick: https://github.com/i18next/i18next-http-middleware/blob/master/lib/languageLookups/cookie.js#L85
and maybe an addition in the readme