-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Internationalized (i18n) Routing + Rewrites doesn't work properly when deployed on Vercel Now #19227
Comments
I updated my project to latests Next.js v10.0.2 stable release, but issue still happens. |
Hi, it looks like the above routes are trying to handle the {
source: "/en(/|)",
destination: 'https://old-website.com',
},
{
source: "/fr(/|)",
destination: 'https://old-website.com/fr',
}, I'm not able to reproduce any issues with the non-index rewrites e.g. |
Hi @ijjk, thank you for following up. I prepared a demo repository in which you can reproduce the errors, and play with the Also it is deployed on Vercel Now: I have found these results so far:
As a side note, the Next.js Hope this helps 🙂 |
This issue in the current iteration (sprint). |
If it could help to solve this one, I have a similar issue with "simple" use case explained here #19482 |
@timneutkens, @ijjk just FYI, in the attached demo repository when clicking on any of the Next.js Issue has already been reported here by another user: #19521 |
Hi, thanks for the demo repo, I opened a PR here to address some issues I noticed while investigating this which appears to have resolved the problems encountered here. I deployed a working version of your demo here with a minor tweak to the external site being rewritten to. Note: the destination must contain the |
This ensures i81n custom routes are resolving correctly, it also corrects redirects for default locales when `locale: false` is not used, and this also simplifies the resolving for custom routes with i18n in `next-server` adding types for the i18n config. This also adds additional tests to prevent regression and starts leveraging a shared `NextConfig` type to allow us to share types for config values. Fixes: #19521 Fixes: #19403 Fixes: #19302 Fixes: #19227
Hey @ijjk Last week I had opened a similar issue #19690 also reporting this problem. I saw that your PR got merged and launched within Thanks in advance :) |
Hi @raulfdm, Updating to I just took a look at your issue #19690, and since you inverted the
The only thing with this approach is that users trying to get to the Related ocumentation: |
Hey @kivohin , thank you for the answer. Yes, if I do like this, for some posts I have the same article in Portuguese and English, everyone's who just tries to reach the english version gets redirected to portuguese version and that's not exactly the behaviour. I'm might being innocent here but I was really expecting redirect works like |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Given below folder structure:
And below
next.config.js
:A website which is being migrated over to Next.js page by page uses the Rewrites feature, when used in combination with the new Internationalized Routing feature, and when deployed to Vercel Now, the Rewrites don't work properly.
Once deployed on Vercel Now the root pages display the Directory Listing page, i.e. on:
On the rest of the Rewrites the 404 page is displayed, i.e. on:
Only the migrated over
pages/stock.jsx
page loads correctly.However above Rewrites do work correctly when running on
localhost
.To reproduce
pages
structure, and abovenext.config.js
configuration.https://old-website.com
innext.config.js
with the website of your choice.Also I prepared a demo repository in which you can reproduce the errors, and play with the next.config.js to see the effects:
https://github.com/kivohin/i18n-routing-rewrites-vercel-now
Expected behavior
When using Rewrites feature, in combination with the new Internationalized Routing, and being deployed on Vercel Now, the Rewrites should work correctly.
System information
Additional context
Above bug report uses Next.js 10.0.2-canary.18, but I also used v10.0.1 with the Rewrites feature, in combination with the new Internationalized Routing and it wouldn't work at all even on
localhost
. It seems some fixes have been introduced so far on theCanary 10.0.2
releases.Maybe #18927 fixed the issue on
locahost
.Also I attempted to add the
locale: false
in each Rewrite as suggested here:Rewrites with i18n support
But that didn't work either.
Thank you in advance 🙏 Keep up the great work! 👏
The text was updated successfully, but these errors were encountered: