-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Middleware Use Breaks Locale Routing on /
Path on Vercel if autodetected locale is not default locale
#34274
Labels
Middleware
Related to Next.js Middleware.
Milestone
Comments
neverether
changed the title
Middleware Use Breaks Locale Routing on
Middleware Use Breaks Locale Routing on Feb 13, 2022
/
Path on Vercel if not on default locale/
Path on Vercel if autodetected locale is not default locale
balazsorban44
added
kind: bug
and removed
bug
Issue was opened via the bug report template.
labels
Feb 17, 2022
This happened to me as well, in particular the |
Same issue here. I had to rewrite including locale. Otherwise, 404 error
|
10 tasks
kodiakhq bot
pushed a commit
that referenced
this issue
Apr 7, 2022
Fixes part of #34274 Navigating to `/` causes to redirect preflight request to a url of browser language like `/en`. This PR fixes to add the locale prefix always so that the redirect does not happen anymore and middleware can get a correct locale. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
It should already be fixed by #35911 |
colinhacks
pushed a commit
to colinhacks/next.js
that referenced
this issue
Apr 14, 2022
Fixes part of vercel#34274 Navigating to `/` causes to redirect preflight request to a url of browser language like `/en`. This PR fixes to add the locale prefix always so that the redirect does not happen anymore and middleware can get a correct locale. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Run
next info
(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.10
What version of Node.js are you using?
14.17.5
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
When using automatic locale detection, and the detected locale is NOT the default locale, trying to route to another locale on
/
results in a failed prefetch error and doesn't complete routing.In my case my locales are
["ja","en"]
and my defaultLocale isja
. My browser language is set to english, and with the automatic locale detection, I'm taken to the/en
route. When I try to route to theja
locale inyarn dev
oryarn build && yarn start
everything works fine. However when I deploy to Vercel I get:And routing is cancelled.
My Japanese users with a japanese langauge setting have no issue moving between the two locales. and if I disable the automatic locale detection I will be taken to
/
with aja
locale as expected, and I can freely route between the two locales.Expected Behavior
I'm expecting to not get a preflight failure from Vercel, and routing to complete successfully.
This might be related to #34199
To Reproduce
I've created a minimum reproducable repo here using
create-next-app
and the official example at: https://github.com/vercel/examples/tree/main/edge-functions/basic-auth-passwordRepo/Commits on Github: https://github.com/sollective/next-locale-bug-repro/commits/main
I also have it hosted on Vercel here:
https://next-locale-bug-repro.vercel.app/en (Credentials are
admin
/password
)(Please set your primary language to English in browser)
The text was updated successfully, but these errors were encountered: