From 84ad2b7684f9a710214f8a0a5af30840795281e0 Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Fri, 28 Mar 2025 15:38:57 +0000 Subject: [PATCH] Update backend/src/main.ts Another go at cors --- backend/src/main.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/backend/src/main.ts b/backend/src/main.ts index 8e98628..5cd16d1 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -1,19 +1,14 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; -const corsOptions = { - origin: 'https://blog.anatid.net', - methods: 'GET,POST,PATCH,DELETE,OPTIONS', - optionsSuccessStatus: 200 -}; async function bootstrap() { const app = await NestFactory.create(AppModule); app.enableCors({ - origin: ['https://blog.anatid.net'], // Allowed origins - methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', // Allowed methods - credentials: true, // Allow credentials (e.g., cookies) - allowedHeaders: 'Content-Type, Accept', // Allowed headers - }); + origin: ['https://blog.anatid.net'], + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', + credentials: true, + allowedHeaders: 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Observe', // Allowed headers + }); await app.listen(process.env.PORT ?? 3000); }