Skip to content
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

feat: Set secure flag for NEXT_LOCALE cookie (ON HOLD) #1272

Closed
wants to merge 1 commit into from

Conversation

amannn
Copy link
Owner

@amannn amannn commented Aug 20, 2024

This is a security enhancement and will disallow users to read the NEXT_LOCALE cookie if the website is served over HTTP. The only exception is on localhost.

See also: Block access to your cookies on MDN

If you'd like to unset this flag, you can compose the middleware and modify the cookie accordingly before the response is returned.

Fixes #1268

Copy link

vercel bot commented Aug 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-intl-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 1:45pm
next-intl-example-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 1:45pm
next-intl-example-app-router-without-i18n-routing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 20, 2024 1:45pm

@amannn amannn marked this pull request as ready for review August 20, 2024 13:46
@amannn amannn changed the title fix: Set secure flag for NEXT_LOCALE cookie feat: Set secure flag for NEXT_LOCALE cookie Aug 22, 2024
@amannn amannn changed the title feat: Set secure flag for NEXT_LOCALE cookie feat: Set secure flag for NEXT_LOCALE cookie (ON HOLD) Aug 23, 2024
@amannn amannn added v4 and removed v4 labels Oct 9, 2024
@amannn
Copy link
Owner Author

amannn commented Oct 21, 2024

As discussed in #1268 (comment), the secure flag might not be a good idea for all users. Instead, we now provide an opt-in way for this via localeCookie (available in v3.22).

@amannn amannn closed this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for Setting HttpOnly and Secure Flags on NEXT_LOCALE Cookie
1 participant