-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Description
Description
Currently, the rate limiting documentation shows a single example of creating chained limiters and applying them at a global level. But is it possible to do the same when adding a rate limiting policy?
I also found this discussion, but again, there does not seem to be an example of creating a policy (non-global) that uses chained limiters.
For example, given:
Microsoft.AspNetCore.RateLimiting.RateLimiterOptions options;
var limiters_array = new RateLimiter[ 2 ];
// limiters_array populated here (code omitted for brevity)
/*
The following will NOT work as the .AddPolicy method expects a
second argument of: Func<HttpContext, RateLimitPartition<TPartitionKey>>
*/
options.AddPolicy( "chained", RateLimiter.CreateChained( limiters_array) );
There does not seem to be an overload (or clear) way to create a policy that incorporates chained limiters.
I have not (yet) come across anything in the documentation that explicitly states something such as:
"chained limiters are only available at a global level"
but if that IS true, it should be added to the documentation.
If I missed something in the documentation, I apologize in advance, but do request a link to the relevant method or page that illustrates how to create a policy that uses chained limiters.
Thanks in advance.
Page URL
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/performance/rate-limit-samples.md
Document ID
d96ee509-2576-279e-29b3-89fbe44b0a28
Platform Id
05af3602-fe02-0ab6-50c5-1058509c4fd9
Article author
Metadata
- ID: d96ee509-2576-279e-29b3-89fbe44b0a28
- PlatformId: 05af3602-fe02-0ab6-50c5-1058509c4fd9
- Service: aspnet-core
- Sub-service: performance