From 378c41ddb2349338c144bda137ad691f91d4cc62 Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Mon, 9 Feb 2026 10:55:11 +0100 Subject: [PATCH] feat(app): enable trust proxy and update app initialization - Activated `trust proxy` setting to retrieve real IP behind reverse proxies. - Updated app initialization to use `NestExpressApplication`. --- backend/src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main.ts b/backend/src/main.ts index 3e892ce..0416fb5 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -1,6 +1,7 @@ import { Logger, ValidationPipe } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import { NestFactory } from "@nestjs/core"; +import { NestExpressApplication } from "@nestjs/platform-express"; import * as Sentry from "@sentry/nestjs"; import { nodeProfilingIntegration } from "@sentry/profiling-node"; import helmet from "helmet"; @@ -8,10 +9,13 @@ import { AppModule } from "./app.module"; import { AllExceptionsFilter } from "./common/filters/http-exception.filter"; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(AppModule); const configService = app.get(ConfigService); const logger = new Logger("Bootstrap"); + // Activer trust proxy pour récupérer l'IP réelle derrière un reverse proxy + app.set("trust proxy", true); + const sentryDsn = configService.get("SENTRY_DSN"); if (sentryDsn) { Sentry.init({