AspNetCoreRateLimit icon indicating copy to clipboard operation
AspNetCoreRateLimit copied to clipboard

[Question] Forwarded headers

Open hypervtechnics opened this issue 6 years ago • 1 comments

Why is this library evaluating the header on its own? Shouldn't the UseForwardedHeaders middleware be used to achieve this? Reference: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-3.1

hypervtechnics avatar Feb 25 '20 19:02 hypervtechnics

I think there may be a way to achieve this with the current implementation. When the RealIpHeader setting is not provided, RateLimitConfiguration defaults to using IpConnectionResolveContributor, which gets the remote IP address from the httpContext.Connection.RemoteIpAddress property populated by UseForwardedHeaders. At the time of writing I haven't tested this.

AlexKubiesa avatar Mar 14 '22 18:03 AlexKubiesa