Skip to content

Commit

Permalink
fix: Proxy attempt3 (#3967)
Browse files Browse the repository at this point in the history
* fix: possibly throttling through the proxy stuff

* fix: changing logging to get some more info hopefully

* fix: small logging tweak

* fix: forwarding fix

* fix: removings logs
  • Loading branch information
YazeedLoonat committed Mar 20, 2024
1 parent 4517900 commit b5f2c8d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions api/src/guards/throttler.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ import { ThrottlerLimitDetail } from '@nestjs/throttler/dist/throttler.guard.int
@Injectable()
export class ThrottleGuard extends ThrottlerGuard {
protected async getTracker(req: Record<string, any>): Promise<string> {
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 (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.headers['x-forwarded-for'];
}
return req.ips.length ? req.ips[0] : req.ip;
}
Expand Down

0 comments on commit b5f2c8d

Please sign in to comment.