-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
What do you think about the potential of having some premade plugins included in the library? For example, if people are serving their website via CF or another reverse proxy, the clients' IP addresses are obscured and so you have to use the CF-Connecting-IP header, otherwise then you just end up ratelimiting CF's IP (e.g., every single user who wants to access that endpoint is now ratelimited).
export class CloudflareRateLimiter implements RateLimiterPlugin {
readonly rate: Rate;
constructor(rate: { limit: number, duration: RateUnit }) {
this.rate = [rate.limit, rate.duration];
}
async hash(event: RequestEvent) {
return event.request.headers.get('cf-connecting-ip') || event.getClientAddress();
}
}Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation