<p>How do I rewrite the URI and send it to two different services?
With this example from Azure. It route all traffic to "aks-helloworld" on <a href="https://demo.azure.com/" rel="nofollow noreferrer">https://demo.azure.com/</a>. However, if the url is: <a href="https://demo.azure.com/hello-world-two" rel="nofollow noreferrer">https://demo.azure.com/hello-world-two</a> the traffic is sent to service "ingress-demo". This is fine. </p>

<p>The problem is when I request <a href="https://demo.azure.com/hello-world-two/test" rel="nofollow noreferrer">https://demo.azure.com/hello-world-two/test</a>. 
How do I request an handler "/test" on the "ingress-demo" service?</p>

<p>Logically you would think to write:
<br>/hello-world-two/* <br>
and <br>
/*
<br>
And this would then send the request to the correct service.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hello-world-ingress
  namespace: ingress-basic
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  tls:
  - hosts:
    - demo.azure.com
    secretName: aks-ingress-tls
  rules:
  - host: demo.azure.com
    http:
      paths:
      - backend:
          serviceName: aks-helloworld
          servicePort: 80
        path: /(.*)
      - backend:
          serviceName: ingress-demo
          servicePort: 80
        path: /hello-world-two(/|$)(.*)
</code></pre>

<p>I solved it,
by changing the path to this:</p>

<pre><code>      - backend:
          serviceName: ingress-demo
          servicePort: 80
        path: /hello-world-two/?(.*)
</code></pre>
