AspNetCoreRateLimit
AspNetCoreRateLimit copied to clipboard
"group" endpoints into one rule
I have the following configuration:
"ClientRateLimitSettings": {
"EnableEndpointRateLimiting": true,
"EnableRegexRuleMatching": true,
"ClientIdHeader": "X-ClientId",
"HttpStatusCode": 429,
"QuotaExceededMessage": "{0}/{1}",
"GeneralRules": [
{
"Endpoint": "get:/api/test",
"Period": "1m",
"Limit": 20
}
]
},
The customer wishes to group all endpoints under /api/test
under one rule, so basically, if I call GET /api/test/123
20 times, after that requests to GET /api/test/456
and GET /api/test
should be blocked, too.
I tried with wildcards, and I tried with RegEx ("Endpoint": "get:/api/test/(.*)"
), however it seems like every endpoint (so /123
and /456
) is treated separately.
I don't know if I am missing something or if that's really not possible?
Any update?
Solution described here: https://github.com/stefanprodan/AspNetCoreRateLimit/issues/78