Get associated RateLimiter for the current HttpContext instance
Hello! I'm currently using and
Microsoft.AspNetCore.RateLimiting
and my question is if is there any way to get the associated RateLimiter instance for the current HttpContext.
8 Replies
it's a middleware which use the configured IOptions<RateLimiterOptions>, what are you trying to do?
I require access to the RateLimiterStatistics of the current request RateLimiter
there is not really a current rate limiter, it can be either the global or a combination of them
I would like to send information about the current rate limit in the headers of each request for more dynamic control
Okay, then what I probably want is a PartitionedRateLimiter
not really possible. at most you can provide a callback for OnRejected, but there are not other extension points at the moment
so you can't for example provide remaining quota
https://github.com/dotnet/aspnetcore/issues/44140 existing issue, not much has happened
GitHub
Rate limiting middleware - Statistics about rate limiters · Issue #...
Is there an existing issue for this? I have searched the existing issues Is your feature request related to a problem? Please describe the problem. The ASP.NET Core rate limiting middleware is grea...
It’s really a shame, and a bit of a problem for me
Thank you so much for the help Sehra!
could take a look at https://github.com/stefanprodan/AspNetCoreRateLimit if that will be a better fit
GitHub
GitHub - stefanprodan/AspNetCoreRateLimit: ASP.NET Core rate limiti...
ASP.NET Core rate limiting middleware. Contribute to stefanprodan/AspNetCoreRateLimit development by creating an account on GitHub.