Skip to content

feat: handle locale autodetection in Netlify redirects #859

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

Closed
ascorbic opened this issue Nov 30, 2021 · 0 comments · Fixed by #861
Closed

feat: handle locale autodetection in Netlify redirects #859

ascorbic opened this issue Nov 30, 2021 · 0 comments · Fixed by #861
Assignees

Comments

@ascorbic
Copy link
Contributor

ascorbic commented Nov 30, 2021

We should implement Next.js locale handling using Netlify redirects. If there are multiple locales and auto-detection is enabled, we should add the following redirects:

  • If browser language does not match the default, but does match one of the other locales, then redirect all requests to / to the appropriate lcoale prefix.
  • If NEXT_LOCALE cookie is set, then rewrite to /.netlify/functions/___netlify-handler instead (to skip the locale detection)
  • Add docs, suggesting that they use the nf_lang cookie instead of NEXT_LANG, for better performance.
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 a pull request may close this issue.

1 participant