-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(next-international): preserve cookies in the middleware #271
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
NextRequest
into NextResponse
NextRequest
into NextResponse
NextRequest
into NextResponse
NextRequest
into NextResponse
I checked and it shouldn't be a problem. We can use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This seems like acceptable changes, I'll try the changes in an app before merging. Also thanks for the added documentation!
I only have one small suggestion:
The fact that I just noticed that this also removes things like "HttpOnly" and "Secure" so the PR doesn't seems to be ready yet :/ |
With my latest commit, the problem seems to have been solved as the Next-Locale cookie is only applied if necessary. I've tried this when we change the locale by url (http://localhost:3000/en => http://localhost:3000/fr) and it doesn't clear my current cookies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried and everything seems to be working as expected, thanks!
I'll merge and make a pre-release before landing this change officially, to make sure we don't break anything.
NextRequest
into NextResponse
Fixes #212
The
response
fromNextResponse.next
andNextResponse.redirect
doesn't contains any cookies except theNext-Locale
set by the middleware.At first, I wanted to clone the
headers
but this added a lot of elements that were not included in the basic Server ActionsEDIT: I've just noticed that the "Set-Cookie" header was defined for each request, which isn't great.