<p>How can I rewrite an URI in a VirtualService but just internally? In other words:</p>
<ol>
<li>A client requests api.example.com/users/get/87</li>
<li>IngressGateway receives the request and translates it to api.example.com/get/87 to the &quot;users&quot; pod. The pod's web server doesn't &quot;know&quot; the URL &quot;api.example.com/users/get/87&quot; but &quot;knows&quot; &quot;api.example.com/get/87&quot;</li>
<li>To the user's browser, it will still be appearing as &quot;api.example.com/users/get/87&quot; not rewrited.</li>
</ol>
<p>I need to do it that way because there are several pod/services to respond this same domain &quot;api.example.com&quot;</p>
<p>If write it like this below, it doesn't work because it will cause conflict since I have many pod/services on the same domain:</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: api
  namespace: default
spec:
  hosts:
  - &quot;api.example.com&quot;
  gateways:
  - istio-system/default-gateway
  http:
  - match:
    - uri:
        prefix: /users
    rewrite:  
      uri: &quot;/&quot;
    route:
    - destination:
        host: user
        port:
          number: 80
  - match:
    - uri:
        prefix: /cars
    rewrite:  
      uri: &quot;/&quot;
    route:
    - destination:
        host: user
        port:
          number: 80
</code></pre>

<p>URL rewrite - Browser URL will not be changed to redirect URL. For ex: &quot;http://xx.xx.xx.xx:8080/api/v1/products&quot; is the url which has been requested in browser.  And in virtual service if you use rewrite: uri: /productpage.  In this case the browser url will still remain &quot;http://xx.xx.xx.xx:8080/api/v1/products&quot;  instead of &quot;http://xx.xx.xx.xx:8080/productpage&quot;</p>
