Skip to content

Commit cb52a58

Browse files
RaHehlRaphael Hehl
andauthored
feat(backend): add getTracker method for IP extraction (hoppscotch#3535)
Co-authored-by: Raphael Hehl <[email protected]>
1 parent 12f35d8 commit cb52a58

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/hoppscotch-backend/src/guards/gql-throttler.guard.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ export class GqlThrottlerGuard extends ThrottlerGuard {
99
const ctx = gqlCtx.getContext();
1010
return { req: ctx.req, res: ctx.res };
1111
}
12+
protected async getTracker(req: Record<string, any>): Promise<string> {
13+
return req.ips.length ? req.ips[0] : req.ip; // individualize IP extraction to meet your own needs
14+
}
1215
}

0 commit comments

Comments
 (0)