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

[i18n] redirects defined in next.config.js doesn't work on Vercel #18795

Closed
deekay44 opened this issue Nov 4, 2020 · 6 comments · Fixed by #19164
Closed

[i18n] redirects defined in next.config.js doesn't work on Vercel #18795

deekay44 opened this issue Nov 4, 2020 · 6 comments · Fixed by #19164
Assignees
Milestone

Comments

@deekay44
Copy link

deekay44 commented Nov 4, 2020

Bug report

Describe the bug

redirects defined with i18n config in next.config.js doesn't work when deploying to Vercel, but work in dev.

Expected behavior

redirects with i18n should work when deploy to Vercel.

System information

  • OS: Windows
  • Browser: Chrome
  • Version of Next.js: 10.0.1
  • Version of Node.js: 12.16.1
@deekay44 deekay44 added the bug Issue was opened via the bug report template. label Nov 4, 2020
@Timer Timer added this to the iteration 12 milestone Nov 4, 2020
@Timer Timer added kind: bug and removed bug Issue was opened via the bug report template. labels Nov 4, 2020
@fpahl
Copy link

fpahl commented Nov 9, 2020

I am experiencing the same issue with next.js 10.0.1.

@dohomi
Copy link

dohomi commented Nov 10, 2020

I am facing the same issue on 10.0.1. redirects work fine on localhost but not deployed via Vercel

@ijjk ijjk added point: 3 and removed point: 3 labels Nov 14, 2020
@kodiakhq kodiakhq bot closed this as completed in #19164 Nov 14, 2020
kodiakhq bot pushed a commit that referenced this issue Nov 14, 2020
This mirrors the `basePath: false` behavior for custom-routes with `locale: false` to allow users to configure the locales manually (`locale: false`) or have the locales be handled automatically for custom-routes. 

Fixes: #18927
Fixes: #18795
@ijjk
Copy link
Member

ijjk commented Nov 14, 2020

Hi, this has been updated in the latest canary of Next.js v10.0.2-canary.17, docs for the new redirects + i18n handling can be viewed here until a new patch release is published, please upgrade and give it a try!

@deekay44
Copy link
Author

@ijjk thank you! But in Next.js v10.0.2-canary.17 defaultLocale is ignored.

For example If we have i18n config
{ locales: ['en', 'fr', 'zh'], defaultLocale: 'en' }

and redirect like this one
{ source: '/first-page', destination: '/second-page', permanent: true }

we will be redirected from /first-page to /en/second-page, for fr and zh locales redirect is correct.

Also found unnecessary redirect for config
{ source: '/first-page', destination: '/', permanent: true }

and in this case we have three redirects instead of two: /first-page -> /en/ -> /en, /fr/first-page -> /fr/ -> /fr

@deekay44
Copy link
Author

Created two separate issues #19405 #19403

@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants