diff --git a/api/src/guards/throttler.guard.ts b/api/src/guards/throttler.guard.ts index e5530cdc4d..cc6976f791 100644 --- a/api/src/guards/throttler.guard.ts +++ b/api/src/guards/throttler.guard.ts @@ -5,7 +5,16 @@ import { ThrottlerLimitDetail } from '@nestjs/throttler/dist/throttler.guard.int @Injectable() export class ThrottleGuard extends ThrottlerGuard { protected async getTracker(req: Record): Promise { - console.log('7:', req.ips.length ? req.ips : req.ip); + console.log( + 'forwarded for:', + req?.headers && req.headers['X-Forwarded-For'], + ); + console.log('ip:', req.ips.length ? req.ips : req.ip); + + if (req?.headers && req.headers['X-Forwarded-For']) { + // if we are passing through the proxy use forwarded for + return req.headers['X-Forwarded-For']; + } return req.ips.length ? req.ips[0] : req.ip; }