How to achieve Clinet IP based routing using Istio features?

Hi all, I am trying to achieve Client IP based routing using Istio features. I have two versions of application V1(Stable) and V2(Canary). I want to route the traffic to the canary version(V2) of the application if the Client IP is from a particular CIDR block (Mostly the CIDR my org) and all other traffic should be routed to the stable version(V1) which is the live traffic.

I am not able to find any possible ways to achieve this. Any kind of help will be appreciated!!

Hi,

Check the docs here on how to preserve the original source IP address – in short, Envoy can include the client IP address in a header called X-Envoy-External-Address. You could then extract that header in your virtualservice and do a regex match for example to route to v1 or v2.