fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.

Home Page:https://fullstackhero.net/dotnet-webapi-boilerplate/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Where to put 'app.UseRateLimiter()'

baranacikgoz opened this issue · comments

In which order to put app.UseRateLimiter()?

I want to implement a rate limiter that is capable of knowing the current user, and allows applying different policies each endpoint in controllers.

I think it should be put after mapping controllers and also after authorization & authorization middlewares. But don't want to put it at the end, if the request should be declined, there is no need to execute unrelated middlewares, the execution pipeline should stop immediately. Where is the possibly earliest place to put app.UseRateLimiter()?

I began to implement it, in the meantime you may suggest the middlewares order.