diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-24 03:01:57 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-24 16:57:10 +0200 |
commit | baeec00f65f74001cae5e6fd4e93767f27e43ceb (patch) | |
tree | 000a3d3734f5ae2940ca829f97be51a042f5c558 /src/api/util/utility | |
parent | Merge branch 'dev/cherry-plugins-improvements' into staging (diff) | |
download | server-baeec00f65f74001cae5e6fd4e93767f27e43ceb.tar.xz |
case insensitive header for rate limits, fix rate limit default settings
Also disabled rate limit bypass right as it doesn't work...
Diffstat (limited to 'src/api/util/utility')
-rw-r--r-- | src/api/util/utility/ipAddress.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/util/utility/ipAddress.ts b/src/api/util/utility/ipAddress.ts index 8d986b26..c96feb9e 100644 --- a/src/api/util/utility/ipAddress.ts +++ b/src/api/util/utility/ipAddress.ts @@ -78,7 +78,11 @@ export function isProxy(data: typeof exampleData) { export function getIpAdress(req: Request): string { // @ts-ignore - return req.headers[Config.get().security.forwadedFor] || req.socket.remoteAddress; + return ( + req.headers[Config.get().security.forwadedFor as string] || + req.headers[Config.get().security.forwadedFor?.toLowerCase() as string] || + req.socket.remoteAddress + ); } export function distanceBetweenLocations(loc1: any, loc2: any): number { |