Istio-使用URI正则表达式匹配进行URI重写 [英] Istio - URI Rewrite with URI Regex Match
本文介绍了Istio-使用URI正则表达式匹配进行URI重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于Istio来说还比较陌生,并且对Istio有疑问.假设我想基于路径重写URI,但是在重写中使用了原始uri的一部分,那是我可以用Regex来做的事情吗?我在想像这样的东西
So relatively new to Istio and have a question regarding Istio. Say that I want to rewrite a URI based on a path, but use part of that original uri in the rewrite, is that something I could do with Regex? I'm imagining something like this
http:
- match:
- uri:
regex: ^/(.*\s*)?(canary)(.*)?$
rewrite:
prefix: "/$1"
其中$ 1是uri正则表达式上的匹配组.这样有可能吗?
Where $1 would be a matching group on the uri regex. Is something like that possible?
推荐答案
仅包含 HTTPMatchRequest .
Only those rule, which contain StringMatch type of values can work with regex. For example HTTPMatchRequest.
很遗憾,不 HTTPRewrite ,仅将strings
作为值
Unfortunately NOT HTTPRewrite, which takes only strings
as a value
这篇关于Istio-使用URI正则表达式匹配进行URI重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文