From 264e0d49aec4d11ddf50afc2ab35c605b98df35e Mon Sep 17 00:00:00 2001 From: Julien Martin Date: Tue, 27 Jan 2026 16:36:53 +0100 Subject: [PATCH] fix: Configuration CORS explicite pour dev localhost --- backend/src/main.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/src/main.ts b/backend/src/main.ts index 1602cec..3943463 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -11,7 +11,14 @@ import { ValidationPipe } from '@nestjs/common'; async function bootstrap() { const app = await NestFactory.create(AppModule, { logger: ['error', 'warn', 'log', 'debug', 'verbose'] }); - app.enableCors(); + + // Configuration CORS pour autoriser les requêtes depuis localhost (dev) et production + app.enableCors({ + origin: true, // Autorise toutes les origines (dev) - à restreindre en prod + methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], + allowedHeaders: ['Content-Type', 'Authorization', 'Accept'], + credentials: true, + }); app.useGlobalPipes( new ValidationPipe({