apiVersion: networking.istio.io/v1
kind: ServiceEntry
metadata:
  name: c
  namespace: testns
spec:
   hosts:
   - c.foo
   ports:
   - number: 80
     name: http
     protocol: HTTP
   resolution: STATIC
   endpoints:
    - address: 127.0.0.1
      ports:
        http: 7072
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: default-route-1
  namespace: testns
spec:
  hosts:
    - c.foo
  gateways:
  #- mesh # doesn't work
  - my-gateway
  http:
    - match:
      - uri:
           prefix: /bar
      route:
      - destination:
          host: c.foo
        weight: 100
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: default-route-2
  namespace: testns
spec:
  hosts:
    - c.foo
  gateways:
  #- mesh
  - my-gateway
  http:
    - match:
      - uri:
           exact: /foo
      rewrite:
        uri: /bar
      route:
      - destination:
          host: c.foo
        weight: 100
