This repository has been archived by the owner on Oct 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deactivate rate limiting correctly (#8)
- Loading branch information
1 parent
05facdf
commit c973a67
Showing
3 changed files
with
23 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { ThrottlerGuard } from '@nestjs/throttler' | ||
import { Injectable } from '@nestjs/common' | ||
// import { ThrottlerGuard } from '@nestjs/throttler' | ||
// import { Injectable } from '@nestjs/common' | ||
|
||
@Injectable() | ||
export class ThrottlerBehindProxyGuard extends ThrottlerGuard { | ||
protected getTracker(req: Record<string, any>) { | ||
console.log('headers', req.headers) | ||
console.log('x-forwarded-for', req.headers['x-forwarded-for']) | ||
console.log('connection.remoteAddress', req.connection.remoteAddress) | ||
console.log('IPs from request headers', req.ips) | ||
console.log('IP from request', req.ip) | ||
return req.headers['x-forwarded-for'] | ||
? req.headers['x-forwarded-for'] | ||
: req.ip | ||
} | ||
} | ||
// @Injectable() | ||
// export class ThrottlerBehindProxyGuard extends ThrottlerGuard { | ||
// protected getTracker(req: Record<string, any>) { | ||
// console.log('headers', req.headers) | ||
// console.log('x-forwarded-for', req.headers['x-forwarded-for']) | ||
// console.log('connection.remoteAddress', req.connection.remoteAddress) | ||
// console.log('IPs from request headers', req.ips) | ||
// console.log('IP from request', req.ip) | ||
// return req.headers['x-forwarded-for'] | ||
// ? req.headers['x-forwarded-for'] | ||
// : req.ip | ||
// } | ||
// } |