更新时间:2024-09-29 GMT+08:00
重写
开启重写,可以在不修改客户端的访问的目标地址前提下,根据配置重写请求的URL。
YAML设置如下:
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: # 配置重写参数
- destination:
host: ratings.prod.svc.cluster.local
subset: v1
请根据实际需求调整配置参数。
父主题: 服务路由