trust reverse proxy

This commit is contained in:
Ammar Qaffaf
2024-02-27 10:39:31 +03:00
parent 43355dd471
commit 89e17fcdc8
2 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,12 @@ import { ValidationPipe } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AuthModule);
// Enable 'trust proxy' setting
app.use((req, res, next) => {
app.getHttpAdapter().getInstance().set('trust proxy', 1);
next();
});
app.enableCors();
app.use(

View File

@ -6,6 +6,14 @@ import { ValidationPipe } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(BackendModule);
// Enable 'trust proxy' setting
app.use((req, res, next) => {
app.getHttpAdapter().getInstance().set('trust proxy', 1);
next();
});
app.enableCors();
app.use(