'Problem dockerizing next js app with i18n localization

I have Next js project with "next-i18next": "11.0.0". Next-i18next use req.headers.host for detecting lang by server. The localhost build is working, but when I launch the app inside docker I get req.headers.host: '0.0.0.0' or localhost.

next.config.js:

const { i18n } = require('./next-i18next.config')

module.exports = {
  i18n,
}

next-i18next.config.js:

module.exports = {
  i18n: {
    defaultLocale: 'en',
    locales: ['en', 'de'],
    localeDetection: false,
    domains: [{
      domain: 'example.de',
      defaultLocale: 'de',
    }, {
      domain: 'example.en',
      defaultLocale: 'en',
    }],
  },
}


Solution 1:[1]

My problem was that I didn't proxy the host inside the docker

location / {
    proxy_pass http://0.0.0.0:8040$request_uri;
    proxy_set_header HOST $host; # this is solution
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Petrov