Route Request According to Source IP

Hi,

I am searching for a way to achieve routing a HTTP/HTTPS request to a service by checking request's source IP. However, the only thing that I found about source ip is ipWhiteList middleware. But since it is a middleware and not a router rule, I can not catch a request in router level. Is there a way to use a router rule that considers incoming request ip ? Or in general, how can I route a request to a service according to its source IP ?