Skip to content

.NET 7 RC1 improvements to Rate limiting middleware #45

Closed
@Rick-Anderson

Description

@Rick-Anderson

Rate limiting middleware improvements

  • Code to update
  • Add [EnableRateLimitingAttribute("MyControllerPolicy")] to Home2Controller
  • disable rate limiting on a specific endpoint within that group
  • apply policies directly to endpoints.
  • add an instance of it directly to an endpoint
  • Add
builder.Services.AddRateLimiter(options =>
{
   options.AddTokenBucketLimiter("MyControllerPolicy", options =>
   {
       options.TokenLimit = 1;
       options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst;
       options.QueueLimit = 1;
       options.ReplenishmentPeriod = TimeSpan.FromSeconds(10);
       options.TokensPerPeriod = 1;
   })
   .AddPolicy<string>("MyGroupPolicy", new MyRateLimiterPolicy());
});

Then @Rick-Anderson can update Rate limiting middleware in ASP.NET Core

@Kahbazi can you do these updates?

Also, the updates requested in #14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions