Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

README.md

Abp.AspNetCoreRateLimit

ABP version NuGet NuGet Download GitHub stars

An Abp module helps you control how often your service is used.

Installation

  1. Install the following NuGet packages. (see how)

    • EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit
    • EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit.Client
    • EasyAbp.Abp.AspNetCoreRateLimit.AspNetCoreRateLimit.Ip
  2. Add DependsOn(typeof(AbpClientLimiterModule)) and DependsOn(typeof(AbpIpLimiterModule)) attribute to configure the module dependencies. (see how)

  3. Extends IHostBuilder with Limiter configuration methods.

    IHostBuilder.UseAspNetCoreRateLimitIp();
    IHostBuilder.UseAspNetCoreRateLimitClient();
  4. Register the middleware below within the OnApplicationInitialization() method of AppModule.cs "before" the UseRouting() middleware:

    app.UseIpRateLimiting();
    app.UseClientRateLimiting();
  5. Add the following code at ConfigureServices() method

    context.Services.AddLimiterService<MemoryCacheRateLimitCounterStore>(service =>
    {
        service.AddLimiterIpService<MemoryCacheIpPolicyStore>();
        service.AddLimiterClientService<MemoryCacheClientPolicyStore>();
    });

Documentation

Rate limiting based on client IP

Rate limiting based on client ID

Advanced configuration

Roadmap

  • Unit test