rsnext/test/integration/custom-routes-i18n/next.config.js
JJ Kasper 75509164ab
Ensure domain locales are redirected client-side (#20562)
This ensures we detect domain specific locales and redirect them client-side. Tests have been added in the `i18n` suite to ensure the domain redirect is applied correctly during a client-side navigation

Fixes: https://github.com/vercel/next.js/issues/19174
2020-12-30 06:44:07 +00:00

84 lines
1.7 KiB
JavaScript

const destination = 'http://localhost:__EXTERNAL_PORT__'
module.exports = {
i18n: {
// localeDetection: false,
locales: ['nl-NL', 'nl-BE', 'nl', 'fr-BE', 'fr', 'en'],
defaultLocale: 'en',
},
async rewrites() {
return [
{
source: '/:path*',
destination: '/:path*',
},
{
source: '/en',
destination: '/en/links',
locale: false,
},
{
source: '/nl-NL',
destination: '/nl-NL/links',
locale: false,
},
{
source: '/fr',
destination: `/fr/links`,
locale: false,
},
{
source: '/en/about',
destination: `${destination}/about`,
locale: false,
},
{
source: '/nl-NL/about',
destination: `${destination}/about`,
locale: false,
},
{
source: '/fr/about',
destination: `${destination}/fr/about`,
locale: false,
},
{
source: '/en/catch-all/:path*',
destination: `${destination}/:path*`,
locale: false,
},
{
source: '/nl-NL/catch-all/:path*',
destination: `${destination}/:path*`,
locale: false,
},
{
source: '/fr/catch-all/:path*',
destination: `${destination}/fr/:path*`,
locale: false,
},
]
},
async redirects() {
return [
{
source: '/redirect-1',
destination: '/destination-1',
permanent: false,
},
{
source: '/nl-NL/redirect-2',
destination: '/destination-2',
locale: false,
permanent: false,
},
{
source: '/redirect-3',
destination: '/another',
permanent: false,
},
]
},
}