-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SameSite=None for cookies #3987
Comments
@kanongil did you find a workaround for this? |
@hueniverse Is there a timeline on when 783987e is going to get released? |
Next two weeks. |
@hueniverse Thanks for your feedback! Can you keep us posted here since this is somewhat of a crucial issue which will kick in once Chrome 80 gets released. |
For reference, this is the code that's working for me: const Hapi = require('@hapi/hapi');
const { isSameSiteNoneCompatible } = require('should-send-same-site-none');
new Hapi.Server({
state: {
isSameSite: false,
isSecure: false, // just an example, can also be true depending on your use case
contextualize: async (definition, request) => {
const userAgent = request.headers['user-agent'] || false;
if (userAgent && isSameSiteNoneCompatible(userAgent)) {
definition.isSecure = true;
definition.isSameSite = 'None';
}
request.response.vary('User-Agent');
},
}
}); I'm using should-send-same-site-none to determine if |
@mfeltscher Thanks for the code snippet. It is very useful. I would probably also add |
@kanongil Good point, adjusted my example accordingly. |
@mfeltscher hey! this is wicked cool. I've been fretting over this issue myself, appreciate you sharing your solution. I'm curious, though: why does your definition set I hope this doesn't come across as critical; genuinely asking. I'm betting I'm missing something 😁 |
@zemccartney It's just an example to show how this can be overridden in the contextualize method. Of course you can just use |
@mfeltscher gotcha. Thanks for the clarification, much appreciated! |
Is there anyway I can use set IsSameSite as None in hapi v17.8.5? |
@rahulakurati I recently needed to do the same in an earlier hapi version. You'll need to modify the |
thaank you so much! |
Support plan
Context
What problem are you trying to solve?
I need to deliver a cross-origin cookie that is compatible with the upcoming Chrome 80. See https://www.chromium.org/updates/same-site & https://tools.ietf.org/html/draft-west-cookie-incrementalism-00.
The
Secure
part is set through theisSecure: true
server state option, but there is no way to addSameSite=None
.Note that this issue might better be categorised as bug, since the the current implementation works to deliver cross-origin cookies, but will fail on Chrome 80.
Do you have a new or modified API suggestion to solve the problem?
Change the server state
isSameSite: false
option to addSameSite=None;
to the returned cookie string.Unfortunately this breaks some not that old browsers including Safari 12 and Chrome 67, so I suspect it needs to be set or not based on the
User-Agent
header of the request. Alternatively, I need an api to signal which variant I want to respond on a particular request with.The text was updated successfully, but these errors were encountered: