Client IP based routing

I’m looking into what the best option for is to route clients based on their specific IP addresses. The goal is to do a blue-green type of route switching but instead of using weights, I need to use specific IP addresses. For each project service (not specifically a kong service) there will be 2 sets of services with url= and url= respectively. Each service will have 1 route with the same path (i.e. path=/test_route), so the only exposed endpoint for the client would be http://localhost:8000/test_route. I was hoping that by white listing client1’s IP on service1 and white listing client2’s IP on service2, they would be routed appropriately, but it looks like I will need to create a custom plugin for that behavior.

I was wondering if what I’m trying to do could be accomplished with stream based routing, where I could dynamically update the sources IP addresses of the clients on a per route basis, but I’m not sure if that makes sense or is even possible on the Layer 4 level for stream routing. The routes will eventually be all over HTTPS as well.

If there is a load-balancer in-front of Kong, which injects x-forwarded-for header to preserve the client IP address, then you could use header-based routing in Kong based on that header and route traffic appropriately via Kong.