How to route multiple prefixes to the same route in istio?

6/21/2019

How to route multiple prefixes to the same route in istio ?

For example: prefix: /api prefix: /something_else

how to route both of the above prefixes to the same route in istio ?

-- Pavan A
istio
kubernetes

1 Answer

6/26/2019

From the Istio official documentation:

HTTP requests with path starting with /wpcatalog/ or /consumercatalog/ will be rewritten to /newcatalog and sent to pods with label “version: v2”.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews-route
spec:
  hosts:
  - reviews.prod.svc.cluster.local
  http:
  - match:
    - uri:
        prefix: "/wpcatalog"
    - uri:
        prefix: "/consumercatalog"
    rewrite:
      uri: "/newcatalog"
    route:
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v2
  - route:
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v1
-- A_Suh
Source: StackOverflow