i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Routes from different domains are mixed

Open cernymatej opened this issue 1 year ago • 8 comments

Environment

  • Operating System: Darwin
  • Node Version: v20.9.0
  • Nuxt Version: 3.14.159
  • CLI Version: 3.15.0
  • Nitro Version: 2.10.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: default
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-v1acupz3?file=app%2Fpages%2Fabout.vue,nuxt.config.ts

Describe the bug

When a project uses different domains to separate localizations and the routes are translated using defineI18nRoute(), the routes from other locales are available in every locale as well. For example, let's say I have route /about available on foo.com and /o-nas on foo.sk. When I go to foo.sk/about, it will still work.

defineI18nRoute({
    paths: {
        en: '/about',
        sk: '/o-nas'
    }
})

Image

Additional context

No response

Logs


cernymatej avatar Nov 13 '24 17:11 cernymatej

Sorry it took half a year for me to look into this, maybe you have removed your reproduction repo or it is not public, could you provide a reproduction? 🙏

BobbieGoede avatar May 23 '25 14:05 BobbieGoede

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 Reproduction starter (v8) 👉 Reproduction starter (v9 and higher) 👉 Reproduction starter (edge)

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

github-actions[bot] avatar May 23 '25 14:05 github-actions[bot]

Closing since I can't access the reproduction, I'll reopen if (access to a) reproduction is provided 🙏

BobbieGoede avatar Jun 03 '25 21:06 BobbieGoede

I must have accidentally deleted the repository while cleaning up 🤦‍♂️ I'll create a new one tomorrow. Sorry I missed your reply from 2 weeks ago.

cernymatej avatar Jun 03 '25 22:06 cernymatej

I have updated the issue with new reproduction and a gif showing the problem.

cernymatej avatar Jun 04 '25 21:06 cernymatej

Hmm, we do require to have some knowledge of the other routes to resolve these when needed. Since these routes should not exist for those domains/locales, should these throw a 404 not found error?

BobbieGoede avatar Oct 31 '25 15:10 BobbieGoede

Wouldn't it be possible not to pass those routes to the client at all when the request domain doesn't have them?

Throwing a 404 on the server seems fine to me.

cernymatej avatar Oct 31 '25 16:10 cernymatej

Wouldn't it be possible not to pass those routes to the client at all when the request domain doesn't have them?

This may be something to explore if perf is a concern, but a separate issue. The routes are still used for language switchers and to have localized head tags, to get around that might be possible by resolving routes through a server route (which has its own perf challenges).

Throwing a 404 on the server seems fine to me.

I'll look into implementing this

BobbieGoede avatar Oct 31 '25 17:10 BobbieGoede