Search code examples
next.jslocalizationnetlify

NextJS localeDetection not working when deployed to Netlify


I have the following NextJS setup and localeDetection works like a charm on localhost, both on the dev server and when build.

But when deployed to Netlify the language detection is not working and the 307 redirect to /en never happens.

i18n: {
  locales: ['en', 'fr'],
  defaultLocale: 'fr',
  localeDetection: true,
},

Language header passed to the server:

Accept-Language: en

Solution

  • Looking back in time it seems that the issue was related to missconfiguratuon in CloudFlare.