it does not work to me
I cant use it
I work with asp net core 3.1
app.UseIpRateLimiting(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); });
and also
"GeneralRules": [ { "Endpoint": "post:/api/account/register", "Period": "60s", "Limit": 4 } ]
but it does not work
Same here, I created a new blank 3.1 project from scratch and it doesn't work either with any of the suggestions I found on the internet. Would be curious to get the code from someone who succeeded to make it work in 3.1
Can you guys please try the latest version https://www.nuget.org/packages/AspNetCoreRateLimit/3.2.1?
The demo web app in this project targets net core 3.1 & all the tests pass
Same here. No error messages and is not work at all. .Net core 3.1 and AspNetCoreRateLimit v3.2.2
.Net core 3.1 and AspNetCoreRateLimit v3.2.2 - not working on kubernetes pod: cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian my settings: { "Endpoint": "get:/.....", "Period": "5s", "Limit": 5 } I send 30 in 5s and 25 was with status 200
Problem on kubernetes pod with: httpContext.Connection.RemoteIpAddress Three requests where sent and see logs below:
Line 41: { "dateTimeOffset": "2021-01-26 14:58:59.783 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-8fb63f3688f5b643a2ea2dffeb0deac3-bd4a677b4ebd6741-00", "message": "RateLimiter -> Doorman key=BAWnU18mbwdR6pQHrhq9sURWV1o=", "eventProperties": { } }
Line 44: { "dateTimeOffset": "2021-01-26 14:59:00.104 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-0102e0b5e0663b4aa88c6fb4178a2292-cd368146f6b3e946-00", "message": "RateLimiter -> IP - httpContext.Connection.RemoteIpAddress=::ffff:10.244.3.0", "eventProperties": { } }
Line 45: { "dateTimeOffset": "2021-01-26 14:59:00.104 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-0102e0b5e0663b4aa88c6fb4178a2292-cd368146f6b3e946-00", "message": "RateLimiter -> ClientIp=::ffff:10.244.3.0, ClientId=anon, HttpVerb=get, Path=\/health\/live", "eventProperties": { } }
Line 46: { "dateTimeOffset": "2021-01-26 14:59:00.104 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-0102e0b5e0663b4aa88c6fb4178a2292-cd368146f6b3e946-00", "message": "RateLimiter -> Doorman key=8nLw4Ei1DLSjBzVkwZu5HGwqEJk=", "eventProperties": { } }
Line 49: { "dateTimeOffset": "2021-01-26 14:59:00.423 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-750b8cd5de93b84984a2de90b333f10a-ad2db2cb09b4f14d-00", "message": "RateLimiter -> IP - httpContext.Connection.RemoteIpAddress=::ffff:10.244.5.0", "eventProperties": { } }
Line 50: { "dateTimeOffset": "2021-01-26 14:59:00.423 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-750b8cd5de93b84984a2de90b333f10a-ad2db2cb09b4f14d-00", "message": "RateLimiter -> ClientIp=::ffff:10.244.5.0, ClientId=anon, HttpVerb=get, Path=\/health\/live", "eventProperties": { } }
Line 51: { "dateTimeOffset": "2021-01-26 14:59:00.425 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-750b8cd5de93b84984a2de90b333f10a-ad2db2cb09b4f14d-00", "message": "RateLimiter -> Doorman key=bdR7MGCXN\/oeAiSFu\/TqJK3TdWk=", "eventProperties": { } }
Line 54: { "dateTimeOffset": "2021-01-26 14:59:00.714 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-8ceb407eee5e5c49b27cc4c1fef7b8e6-204fe93400359e44-00", "message": "RateLimiter -> IP - httpContext.Connection.RemoteIpAddress=::ffff:10.244.1.0", "eventProperties": { } }
Line 55: { "dateTimeOffset": "2021-01-26 14:59:00.714 +00:00", "level": "Error", "name": "AspNetCoreRateLimit.RateLimitMiddleware`1", "traceId": "00-8ceb407eee5e5c49b27cc4c1fef7b8e6-204fe93400359e44-00", "message": "RateLimiter -> ClientIp=::ffff:10.244.1.0, ClientId=anon, HttpVerb=get, Path=\/health\/live", "eventProperties": { } }
One of the solution might be used: https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Resolve-Contributors Own IP resolver