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`.
This commit is contained in:
Mathis HERRIOT
2026-02-09 10:55:11 +01:00
parent 65b161dfc6
commit 378c41ddb2

View File

@@ -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<NestExpressApplication>(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<string>("SENTRY_DSN");
if (sentryDsn) {
Sentry.init({