Просмотр исходного кода

Aggiornata la gestione dei basepath

main
Lorenzo Pollutri 3 недель назад
Родитель
Сommit
8978cc2a61
1 измененных файлов: 20 добавлений и 0 удалений
  1. +20
    -0
      next.config.ts

+ 20
- 0
next.config.ts Просмотреть файл

@@ -5,6 +5,26 @@ const nextConfig: NextConfig = {
basePath: BASE_PATH || undefined,
allowedDevOrigins: ['10.210.1.225'],
serverExternalPackages: ['sanitize-html', 'file-type'],
// Quando l'app vive sotto un sotto-percorso, le rotte "nude" rispondevano 404:
// chi atterra su http://host:3000/ o /admin viene rediretto sotto il basePath.
// basePath: false evita che Next prefissi automaticamente source/destination.
async redirects() {
if (!BASE_PATH) return [];
return [
{
source: '/',
destination: BASE_PATH,
basePath: false,
permanent: false,
},
{
source: '/admin',
destination: `${BASE_PATH}/admin`,
basePath: false,
permanent: false,
},
];
},
};

export default nextConfig;

Загрузка…
Отмена
Сохранить