我有一个Istio 1.4.6 VirtualService,具有一个匹配项和一个URL重写,定义如下:
match:
- authority:
prefix: example.com
uri:
prefix: /foo/bar
rewrite:
uri: /
route:
- destination:
host: some-service
port:
number: 80
我想像下面这样重写:
指向/foo/bar
的交通或其任何子路径应重写为/
加上some-service
上的任何子路径。
i.e.
example.com/foo/bar -> some-service
example.com/foo/bar/subpath -> some-service/subpath
example.com/foo/bar/subpath/anothersubpath -> some-service/subpath/anothersubpath
但是,当我对进入some-service
的流量进行系统分析时,我发现Istio已将路径重写为:
GET //subpath/anothersubpath HTTP/1.1
注意GET请求中的两个斜杠。在VirtualService spec rewrite.uri
字段中,我似乎无法将该字段保留为空白或在其中添加空字符串。这样做会导致资源无法验证。
即我不能这样做:
rewrite:
uri: ""
而且不能这样做
rewrite:
uri:
我如何定义VirtualService重写以将流量发送到目标服务的根目录?任何帮助深表感谢。