https://github.com/easyabp/abp.aspnetcoreratelimit
An Abp module helps you control how often your service is used.
https://github.com/easyabp/abp.aspnetcoreratelimit
abp abp-vnext aspnetcoreratelimit dotnetcore easyabp rate-limiting rate-limits
Last synced: about 1 year ago
JSON representation
An Abp module helps you control how often your service is used.
- Host: GitHub
- URL: https://github.com/easyabp/abp.aspnetcoreratelimit
- Owner: EasyAbp
- License: mit
- Created: 2020-03-16T14:54:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-27T16:29:32.000Z (over 1 year ago)
- Last Synced: 2024-10-29T16:20:45.191Z (over 1 year ago)
- Topics: abp, abp-vnext, aspnetcoreratelimit, dotnetcore, easyabp, rate-limiting, rate-limits
- Language: C#
- Homepage:
- Size: 2.16 MB
- Stars: 27
- Watchers: 2
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: docs/README.md
- License: LICENSE
Awesome Lists containing this project
README
# Abp.AspNetCoreRateLimit
[](https://abp.io)
[](https://www.nuget.org/packages/EasyAbp.Abp.AspNetCoreRateLimit)
[](https://www.nuget.org/packages/EasyAbp.Abp.AspNetCoreRateLimit)
[](https://discord.gg/xyg8TrRa27)
[](https://www.github.com/EasyAbp/Abp.AspNetCoreRateLimit)
An Abp module helps you control how often your service is used.
## Installation
1. Install the following NuGet packages. ([see how](https://github.com/EasyAbp/EasyAbpGuide/blob/master/How-To.md#add-nuget-packages))
* EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit
* EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit.Client
* EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit.Ip
1. Add `DependsOn(typeof(AbpClientLimiterModule))` and `DependsOn(typeof(AbpIpLimiterModule))` attribute to configure the module dependencies. ([see how](https://github.com/EasyAbp/EasyAbpGuide/blob/master/How-To.md#add-module-dependencies))
1. Extends IHostBuilder with Limiter configuration methods.
```csharp
IHostBuilder.UseAspNetCoreRateLimitIp();
IHostBuilder.UseAspNetCoreRateLimitClient();
```
1. Register the middleware below within the `OnApplicationInitialization()` method of `AppModule.cs` "before" the `UseRouting()` `middleware`:
```csharp
app.UseIpRateLimiting();
app.UseClientRateLimiting();
```
1. Add the following code at `ConfigureServices()` method
```csharp
context.Services.AddLimiterService(service =>
{
service.AddLimiterIpService();
service.AddLimiterClientService();
});
```
# Documentation
Rate limiting based on client IP
- [Setup and configuration](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware#setup)
- [Defining rate limit rules](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware#defining-rate-limit-rules)
- [Behavior](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware#behavior)
- [Update rate limits at runtime](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/IpRateLimitMiddleware#update-rate-limits-at-runtime)
Rate limiting based on client ID
- [Setup and configuration](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/ClientRateLimitMiddleware#setup)
- [Defining rate limit rules](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/ClientRateLimitMiddleware#defining-rate-limit-rules)
- [Behavior](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/ClientRateLimitMiddleware#behavior)
- [Update rate limits at runtime](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/ClientRateLimitMiddleware#update-rate-limits-at-runtime)
Advanced configuration
- [Customize the quoata exceeded response](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Quota-exceeded-response)
- [IP / ClientId resolve contributors](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Resolve-Contributors)
- [Use Redis as a distributed counter store](https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store)
# Roadmap
- [ ] Unit test