Updated on 2025-04-25 GMT+08:00

Rewriting

If the rewriting option is enabled, the client is instructed to access a resource at a different address than the client originally requested.

Configure the YAML file as follows:

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: ratings-route
spec:
  hosts:
  - ratings.prod.svc.cluster.local
  http:
  - match:
    - uri:
        prefix: /ratings
    rewrite:
      uri: /v1/bookRatings
    route:                           # Configure rewriting parameters.
    - destination:
        host: ratings.prod.svc.cluster.local
        subset: v1

You can configure the parameters based on site requirements.