Currently I'm struggling with odd phenomenon about losing cookie..
Previously, I used AWS as my infra to handle frontend and backend as well.
Due to deployment issue, (frontend deployment sequence took too long) decided to use Vercel for frontend.
Whats happening now, is that request started not to append cookie on request header.
Since I'm currently developing streaming service,
I have 3 actors for streaming scenario
I'll abbreviate as (a.domain.com , b.domain.com, c.domain.com)
a.domain.com = frontend b.domain.com = backend c.domain.com = dvd server
below is my scenario
Looking at inspection table of cookie (chrome inspection tool->application tab), it seems that set-cookie
works well.
but while making request to "c.domain.com" I'm finding that cookie is lost on request header.
What I've tried??
set
credential : 'include'
while fetching :: frontend
allow CORS :: backend
add Domain
attribute while setting cookie :: backend
(ex.
Set-Cookie: wwwCookie=wwwCookie; Domain=.domain.com
) <- not sure is it
Domain=domain.com
)
P.S
While comparing with previous request and current request(which fail)
I've found that partition key
is added for current request. Does this relates to current issue?
Solved it!
The problem was coming from AWS API Gateway configuration.
I've needed to set CORS configuration of API Gateway service exactly same as my server configuration setting.
Followed following article
https://medium.com/@sharadokey/understanding-cors-and-cross-origin-cookies-bf36d624da78
Sending Thanks to Sharadokey