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

Domain based localed can not working on next 15+ #1572

Closed
3 tasks done
tianyingchun opened this issue Nov 22, 2024 · 7 comments
Closed
3 tasks done

Domain based localed can not working on next 15+ #1572

tianyingchun opened this issue Nov 22, 2024 · 7 comments
Labels
bug Something isn't working reproduction-missing unconfirmed Needs triage.

Comments

@tianyingchun
Copy link

Description

import { createNavigation } from 'next-intl/navigation';
import { defineRouting } from 'next-intl/routing';
import { LanguageCode } from '@/generated-types';

export const routing = defineRouting({
  // A list of all locales that are supported
  locales: [LanguageCode.en, LanguageCode.de],
  // Used when no locale matches
  defaultLocale: LanguageCode.en,
  localePrefix: 'as-needed',
  localeDetection: false,
  domains: [
    {
      domain: 'www.issilo.com',
      defaultLocale: LanguageCode.en,
      locales: [LanguageCode.en],
    },
    {
      domain: 'www.issilo.de',
      defaultLocale: LanguageCode.de,
    },
  ],
});

the domain based localed always return en

if we use prefix locale (/en,/de) it works
www.issilo.com ==> en
www.issilo.de ===> en (wrong)

Verifications

Mandatory reproduction URL

https://github.com/tianyingchun/next-intl-issue

Reproduction description

Steps to reproduce:

  1. Open reproduction
  2. Click on …
  3. See error: …

Expected behaviour

domain based works correct

@tianyingchun tianyingchun added bug Something isn't working unconfirmed Needs triage. labels Nov 22, 2024
Copy link

Thank you for your report!

Unfortunately, the reproduction is missing or incomplete, and as such we cannot investigate this issue. Please add a reproduction to the issue, otherwise it will be closed automatically.

Templates:

Creating a good reproduction takes time.

To help us resolve the issue quickly, please simplify the reproduction as much as possible by removing any unnecessary code, files, and dependencies that are not directly related to the problem. The easier it is for us to see the issue, the faster we can help you.

Apart from the reproduction, make sure to include the precise steps on how to reproduce the issue, e.g.:

  1. Open reproduction
  2. Click on …
  3. See error: …

Thank you for your understanding!

FAQ

"I've included a reproduction, what is missing?"

This comment might have been added because your reproduction doesn't point to a destination where the issue can be reproduced. Please make sure that the latest changes were saved in the reproduction and that the link is correct.

@tianyingchun
Copy link
Author

yes, i will attach reproduce repo.

@tianyingchun
Copy link
Author

@tianyingchun
Copy link
Author

BTW: we have multiple domain points one next server port: 3000,

@tianyingchun
Copy link
Author

 [ 'x-forwarded-for', '127.0.0.1' ],
 [ 'x-forwarded-host', 'www.issilo.de:443' ],
 [ 'x-forwarded-port', '4001' ],
 [ 'x-forwarded-proto', 'http' ],
 [ 'x-forwarded-server', 'www.issilo.de' ],
 [ 'x-nginx-proxy', 'true' ],
 [ 'x-real-ip', '127.0.0.1' ]

nginx proxy forward, it caused for port 443? i used https

@tianyingchun
Copy link
Author

i found i need to config domains with. below it works

export const routing = defineRouting({
  // A list of all locales that are supported
  locales: [LanguageCode.en, LanguageCode.de],
  // Used when no locale matches
  defaultLocale: LanguageCode.en,
  localePrefix: 'never',
  localeDetection: true,
  domains: [
    {
      domain: 'www.issilo.com:443',
      defaultLocale: LanguageCode.en,
      locales: [LanguageCode.en],
    },
    {
      domain: 'www.issilo.de:443',
      defaultLocale: LanguageCode.de,
      // If there are no `locales` specified on a domain,
      // all available locales will be supported here
    },
  ],
});

domain with port 443? it this a issue?

@tianyingchun
Copy link
Author

i have changed nignx proxy to remove port , works fine, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduction-missing unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants