Skip to content

Commit f0d14af

Browse files
Update content/security/rate-limiting.md
1 parent 2e51364 commit f0d14af

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

content/security/rate-limiting.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ If your NestJS server runs behind a proxy server, check the specific HTTP adapte
4545
// throttler-behind-proxy.guard.ts
4646
import { ThrottlerGuard } from '@nestjs/throttler';
4747
import { Injectable } from '@nestjs/common';
48+
4849
@Injectable()
4950
export class ThrottlerBehindProxyGuard extends ThrottlerGuard {
5051
protected getTracker(req: Record<string, any>): string {
5152
return req.ips.length ? req.ips[0] : req.ip; // individualize IP extraction to meet your own needs
5253
}
5354
}
55+
5456
// app.controller.ts
5557
import { ThrottlerBehindProxyGuard } from './throttler-behind-proxy.guard';
58+
5659
@UseGuards(ThrottlerBehindProxyGuard)
5760
```
5861

0 commit comments

Comments
 (0)