diff --git a/src/main.ts b/src/main.ts index 4299806..c9256ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,15 +1,14 @@ +import { RequestContextMiddleware } from '@app/common/middleware/request-context.middleware'; +import { SeederService } from '@app/common/seed/services/seeder.service'; +import { Logger, ValidationPipe } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; -import { AppModule } from './app.module'; +import { json, urlencoded } from 'body-parser'; import rateLimit from 'express-rate-limit'; import helmet from 'helmet'; -import { setupSwaggerAuthentication } from '../libs/common/src/util/user-auth.swagger.utils'; -import { ValidationPipe } from '@nestjs/common'; -import { json, urlencoded } from 'body-parser'; -import { SeederService } from '@app/common/seed/services/seeder.service'; -import { HttpExceptionFilter } from './common/filters/http-exception/http-exception.filter'; -import { Logger } from '@nestjs/common'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; -import { RequestContextMiddleware } from '@app/common/middleware/request-context.middleware'; +import { setupSwaggerAuthentication } from '../libs/common/src/util/user-auth.swagger.utils'; +import { AppModule } from './app.module'; +import { HttpExceptionFilter } from './common/filters/http-exception/http-exception.filter'; async function bootstrap() { const app = await NestFactory.create(AppModule); @@ -27,9 +26,16 @@ async function bootstrap() { rateLimit({ windowMs: 5 * 60 * 1000, max: 500, + standardHeaders: true, + legacyHeaders: false, }), ); + app.use((req, res, next) => { + console.log('Real IP:', req.ip); + next(); + }); + app.getHttpAdapter().getInstance().set('trust proxy', 1); app.use(