vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.51k stars 26.92k forks source link

i18n with multiple domains exposes a lot of urls that shouldn't be available #21210

Open sebastian-nowak opened 3 years ago

sebastian-nowak commented 3 years ago

What version of Next.js are you using?

10.0.5

What version of Node.js are you using?

15.6.0

What browser are you using?

n/a

What operating system are you using?

n/a

How are you deploying your application?

next build && next start

Describe the Bug

According to the docs, for the following i18n config:

  i18n: {
    locales: ['en', 'pl'],
    defaultLocale: 'en',
    domains: [
      {
        domain: 'example.com',
        defaultLocale: 'en'
      },
      {
        domain: 'example.pl',
        defaultLocale: 'pl'
      }
    ]
  }

and pages/index.js & pages/about.js files only the following urls should be available:

That's not the case, there are others that are accessible too:

Expected Behavior

These extra urls should correctly display 404 or at least redirect to the correct domain with the locale prefix stripped

To Reproduce

.

sebastian-nowak commented 3 years ago

On a side note, being able to access https://example.com/en is a strange issue on its own. I would expect that to redirect to / if using subfolder routing and to 404 when using multiple domains.

simplenotezy commented 2 years ago

Any updates on this?