This commit is contained in:
2026-02-06 12:15:43 +03:00
parent d654b1ffc8
commit 6d96372682
7 changed files with 60 additions and 11 deletions

View File

@ -15,14 +15,16 @@ async function bootstrap() {
// Security
app.use(helmet());
// CORS (веб на 3080)
// CORS — allow the web frontend origin (from NEXT_PUBLIC_APP_URL) + localhost for dev
const appUrl = configService.get('NEXT_PUBLIC_APP_URL');
const allowedOrigins = [
configService.get('NEXT_PUBLIC_APP_URL'),
'http://localhost:3080',
'http://localhost:3000',
].filter(Boolean) as string[];
...new Set(
[appUrl, 'http://localhost:3080', 'http://localhost:3000'].filter(Boolean) as string[],
),
];
console.log('CORS allowed origins:', allowedOrigins);
app.enableCors({
origin: allowedOrigins.length ? allowedOrigins : 'http://localhost:3080',
origin: allowedOrigins,
credentials: true,
});