From 2435436580345a395125bfb21b0df8f7b942eb90 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Thu, 6 Apr 2023 14:04:04 +0530 Subject: [PATCH] chore: changes origins to view whitelisted origins in backend (#70) --- packages/hoppscotch-backend/src/app.module.ts | 2 +- packages/hoppscotch-backend/src/main.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-backend/src/app.module.ts b/packages/hoppscotch-backend/src/app.module.ts index a52d7984b..63a5bd579 100644 --- a/packages/hoppscotch-backend/src/app.module.ts +++ b/packages/hoppscotch-backend/src/app.module.ts @@ -26,7 +26,7 @@ import { ThrottlerModule } from '@nestjs/throttler'; buildSchemaOptions: { numberScalarMode: 'integer', }, - cors: process.env.PRODUCTION !== 'true' && { + cors: { origin: process.env.WHITELISTED_ORIGINS.split(','), credentials: true, }, diff --git a/packages/hoppscotch-backend/src/main.ts b/packages/hoppscotch-backend/src/main.ts index aedac38d0..15764ce15 100644 --- a/packages/hoppscotch-backend/src/main.ts +++ b/packages/hoppscotch-backend/src/main.ts @@ -37,7 +37,8 @@ async function bootstrap() { console.log('Enabling CORS with production settings'); app.enableCors({ - origin: true, + origin: process.env.WHITELISTED_ORIGINS.split(','), + credentials: true, }); } app.enableVersioning({