The headers in Edge Function is collapsed #271
Locked
unix
started this conversation in
Show & Tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, this issue describes what may be a bug, but I'm not sure if the service is behaving as expected and may need your help 🙏
Description
In Vercel's Edge Function service, all headers will be collapsed, which is very unfriendly to
set-cookie
and may not be recognized by browsers.Example
This is a simple example I created for a project with only one middleware using Edge Function, setting 2 cookies and doing nothing:
set-cookie
should be expanded when there is no middleware, and in fact, we get this when we run next.js locally:When we run this example on Edge Function, the
set-cookie
fields will be collapsed together as follows:Impact
When accessing a collapsed cookie in a browser, the browser will only receive the first value(only
key1
). And the result on the Edge Function is not consistent with the local development, which may cause trouble for users to find the cause of the problem.Also as a side note, I noticed that in RFC 2109 it states that the middleware can fold the headers, which seems reasonable, but is there a way we can work around this or make the results run the same locally as on the service?
View questions online
curl --head https://api-fold-cookies.vercel.app
.Beta Was this translation helpful? Give feedback.
All reactions