You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the edge-runtime package with the code below, the second cookie auth_2=456 is ignored due to the set-cookie being concatenated.
❗️ Set-Cookie header field-values are sometimes comma joined in one string. This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
Let the concatenated cookies be split like this with the splitCookiesString.
Possible solution
The possible solution is that you can use the splitCookiesString (needs to be exported for use) found in the @edge-runtime/cookies package and inserted into the toNodeHeaders of the edge-runtime package like below:
// The `toNodeHeaders` function converts headers from the browser format to the Node.js format. // Here, we modify it to split concatenated Set-Cookie values using `splitCookiesString` from the `@edge-runtime/cookies` package.functiontoNodeHeaders(headers?: Headers): NodeHeaders{constresult: NodeHeaders={}if(headers){for(const[key,value]ofheaders.entries()){result[key]=key?.toLowerCase()==='set-cookie' ? splitCookiesString(value) : value}}returnresult}
Additional context/screenshots
I can work on that if it makes sense for the package. 😉
The text was updated successfully, but these errors were encountered:
Bug Report
Current behavior
When using the
edge-runtime
package with the code below, the second cookieauth_2=456
is ignored due to the set-cookie being concatenated.❗️
Set-Cookie header field-values are sometimes comma joined in one string. This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
Expected behavior/code
Let the concatenated cookies be split like this with the
splitCookiesString
.Possible solution
The possible solution is that you can use the
splitCookiesString
(needs to be exported for use) found in the@edge-runtime/cookies
package and inserted into thetoNodeHeaders
of theedge-runtime
package like below:Original Code: https://github.com/vercel/edge-runtime/blob/main/packages/runtime/src/server/create-handler.ts#L117
Suggestion:
Additional context/screenshots
I can work on that if it makes sense for the package. 😉
The text was updated successfully, but these errors were encountered: