Cookie “io” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict” #3784
Unanswered
online0227
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to send cookie to api server from only specific domain I set, where react client exists.
I get errors like (on firefox since chrome doesn't show an error while not working correctly as well):
If I test them on localhost with just different ports (e.g. http://localhost:4001 and http://localhost:4002), they works fine because both client and server resides in localhost. The error above only shows when separating them to different domains (e.g. http://app1.localhost and http://app2.localhost).
In client, I connect api server like:
In server, I receive this:
I tried everything written in https://socket.io/docs/v3/handling-cors/ but none of them works.
Following is my socket.io versions:
Following is what I get the value of "socket.handshake.headers" when cookie is received by testing them in same domain. Here you can see that cookie is attached:
Following is what I get the value of "socket.handshake.headers" when cookie is NOT received by testing them in different domain (which is issue I have right now). Here you can see that cookie is NOT attached:
How can I send cookie via different domain using Socket.IO?
Beta Was this translation helpful? Give feedback.
All reactions