我有一个 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
但是,当我 sysdig 流量进入some-service
,我看到 Istio 已将路径重写为:
GET //subpath/anothersubpath HTTP/1.1
请注意 GET 请求中的两个斜杠。在 VirtualService 规范中rewrite.uri
字段,我似乎无法将该字段留空或在那里添加空字符串。这样做会导致资源无法验证。
IE。我不能做到这一点:
rewrite:
uri: ""
并且不能这样做
rewrite:
uri:
如何定义 VirtualService 重写以将流量发送到目标服务的根?任何帮助深表感谢。
另一种方法是:
- match:
- uri:
prefix: "/v2/my-service/"
- uri:
exact: "/v2/my-service"
rewrite:
uri: "/"
route:
- destination:
host: my-internal-service
port:
number: 6666
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)