diff --git a/backend/server/src/main.ts b/backend/server/src/main.ts index 97ae368..e0b7b04 100644 --- a/backend/server/src/main.ts +++ b/backend/server/src/main.ts @@ -10,7 +10,12 @@ async function bootstrap() { if (process.env.NODE_ENV !== 'production') { swaggerSetup(app); } - app.enableCors(); + + const frontPath = process.env.FRONT_ORIGIN; + app.enableCors({ + origin: frontPath, + credentials: true, + }); app.use(helmet()); app.use(cookieParser()); app.useGlobalPipes( diff --git a/backend/server/src/util/options/config.option.ts b/backend/server/src/util/options/config.option.ts index 2d32f8e..4f6b181 100644 --- a/backend/server/src/util/options/config.option.ts +++ b/backend/server/src/util/options/config.option.ts @@ -24,6 +24,10 @@ class EnvironmentVariables { @IsString() REDIS_HOST: string; + + @IsString() + FRONT_ORIGIN: string; + @IsNumber() @Transform(({ value }) => parseInt(value)) REDIS_PORT: number;