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({