stefanprodan / WebApiThrottle

ASP.NET Web API rate limiter for IIS and Owin hosting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't do custom ip address parsing Owin

marklane23 opened this issue · comments

Setting a new CustomIpAddressParser() for Owin setup doesn't actually call the custom parser.

The bug exists in ThrottlingMiddleware, SetIdentity. this is missing a call to core.IpAddressParser.

Inside ThrottlingHandler, SetIdentity we see:
entry.ClientIp = core.GetClientIp(request).ToString();

but in ThrottlingMiddleware we see:
entry.ClientIp = request.RemoteIpAddress;

in order for this to work we need to setup a method or call to IpAddressParser so the overloaded method can be reached, like:
entry.ClientIp = core.GetOwinClientIp(request);