#setting cookies infinite redirect loop
1 messages · Page 1 of 1 (latest)
potenntially found the cause
_remix_session_v2 cookie is appears twice in the cookie header.
and decoding it with jwt.io shows its malformed
how is that possible
you shouln’t send a response header with the name "Cookie", instead the cookie name should be "Set-Cookie" which instructs the receiver (browser) to attempt to set that cookie
here
it still happens after changing it to this
what could be malforming the cookie
Did you figure this out? I'm hitting the same issue
@hot surge what kind of object is the headers variable? If it's the standard one I believe you want to use .set rather than .push. So something like
headers.set("Set-Cookie", newSession)
yeah i narrowed it down a bit, somewhere between the lambda and the browser the set cookie param is being handled wrongly. the bug could be in remix code
this is likely because the lambda output is not standard HTTP stuff and does some manipulating of cookies
i moved the code out of the root loader into the server code with a custom handler so i add the set cookie param after the loaders have been handled and the response gets sent to browser
cookies still get malformed but it somehow now at least duplicates the malformed cookie and doesn't wreck the original
im moving to cloudflare and will see if i still have the same issue there
i've gone through many iterations and tried Set-Cookie tried Cookie tried array of arrays tried headers object
tried moving it to get set at a different point and that resolved my specific bug but not the underlying issue
fk this seems painful