AspNetCoreRateLimit icon indicating copy to clipboard operation
AspNetCoreRateLimit copied to clipboard

Is it possible to support multiple values for RealIpHeader?

Open agc93 opened this issue 5 years ago • 3 comments

CloudFlare, for example. uses CF-Connecting-IP (for some reason) and doesn't set X-Real-IP correctly.

While I could use the config to set RealIpHeader to CF-Connecting-IP this would break requests not coming through CloudFlare. Is it possible to set multiple values for tracking client IPs through reverse proxies?


From a quick look at RateLimitConfiguration and IpRateLimitOptions I couldn't see anything that suggested support for multiple headers, but I also might be looking in the wrong place.

agc93 avatar Mar 02 '20 04:03 agc93

Hi @agc93, you can implement your own Resolve Contributor and use it with a custom configuration. Here's a link to the wiki explaining how: https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Resolve-Contributors

cristipufu avatar Mar 07 '20 16:03 cristipufu

@agc93 did you come right with this? Do you have an example to share so this can be closed and used as a reference for others?

dylanvdmerwe avatar Oct 23 '23 12:10 dylanvdmerwe

I don't have an examnple to share as I ended up pursuing a different solution with Cloudflare and a reverse proxy for local requests.

agc93 avatar Oct 25 '23 01:10 agc93