Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RateLimiting Not Working #474

Open
DhanushAdla opened this issue Dec 8, 2023 · 1 comment
Open

RateLimiting Not Working #474

DhanushAdla opened this issue Dec 8, 2023 · 1 comment

Comments

@DhanushAdla
Copy link

I have followed as below but not able to figure out the issue.

builder.Services.AddMemoryCache();
builder.Services.Configure(options =>
{
options.GeneralRules = new List
{
new RateLimitRule
{
Endpoint="/eTest-service/eTest/*",
Limit=2,
Period="1m",
}
};
});

builder.Services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
builder.Services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
//builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
builder.Services.AddSingleton<IRateLimitConfiguration, RateLimitConfiguration>();
builder.Services.AddSingleton<IProcessingStrategy, AsyncKeyLockProcessingStrategy>();

app.UseIpRateLimiting();

I have endpoints as https://testing.com/eTest-service/eTest/method1 or method2 and so on...

Also health check as https://testing.com/health

I dont want to include rate limiting for health check when I add endpoint as * eveything is limited and when I add as /eTest-service/eTest/* it allows n number of times, basically limiting not working.

Could you please help on this.

@DhanushAdla
Copy link
Author

Can someone please help on this!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant