javascriptnestjs

How to rate limit a NestJS API by multiple time intervals?


I am trying to rate limit my API with @NestJs/throttler. I want to set two different limit caps:

Setting either one of these rate limits is explained in the docs and is pretty straight forwad. But, setting both limitations is not articulated in the docs.

How can I rate limit my API by both time intervals?


Solution

  • As I told you on Discord, with @nestjs/throttler, this functionality currently doesn't exist. You can have one or the other, or you can override the global config to be more specific for one endpoint, but there's not currently a way to have two limits set up.