<p>Is it possible to do the traffic routing using the route rules as described in the image below? The traffic routing would need to happen right after the traffic enters the cluster.</p>

<p><a href="https://i.stack.imgur.com/5Y9C3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Y9C3.png" alt="enter image description here"></a></p>

<p>We have been fiddling around with them but always hit a wall as soon as we had two route rules and used a uri regex in one of the rules.</p>

<p>Our idea is to configure the istio ingress like so</p>

<pre><code># Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: gateway
  annotations:
    kubernetes.io/ingress.class: "istio"
spec:
  backend:
    serviceName: frontend
    servicePort: 8080
</code></pre>

<p>And then configure the route rules that split the traffic depending on the uri header. Here is an example of how we would configure the products route rule:</p>

<pre><code>apiVersion: config.istio.io/v1alpha2
kind: RouteRule
metadata:
  name: products-rule
spec:
  destination:
    name: frontend
  precedence: 2
  match:
    request:
      headers:
        uri:
          regex: "^/(?:.*?)/?products(?:/.*)?$"
  route:
  - labels:
      fe-app: products
</code></pre>

<p>Is this setup possible with istio?</p>

<p>UPDATE: It seems Kubernetes Ingress does not support regular expressions, see <a href="https://github.com/kubernetes/ingress-nginx/issues/1360" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/issues/1360</a>. <strong>So the answer below would not work.</strong></p>

<p>I would create three different services: <code>products</code>, <code>settings</code> and <code>customers</code> and use Kubernetes Ingress <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#simple-fanout" rel="nofollow noreferrer">fanout</a>. I would use your regex expressions for the paths. I would try it first with a plain Kubernetes Ingress, without <code>kubernetes.io/ingress.class: "istio"</code> annotation. If it would work, I would add the Istio annotation and verify that it works as Istio Ingress as well.</p>
