如何在Gloo Ingress控制器中路由具有动态值的请求

时间:2020-10-01 16:09:58

标签: kubernetes-ingress nginx-ingress gloo

如何路由包含动态部分的请求。例如,我想要请求

import re

sr = "base | text1: 0.01 | text2: 0.02 | text3: 100.1"

pattern1 = r"^(\w+)((?:\s+\|\s+[\w\s]+\s*:\s*\d+\.\d+)+)$"
bases = re.findall (pattern1, sr)

for base in bases:
    result = [base[0]]
    pattern2 = r"\|\s+([\w\s]+)\s*:\s*(\d+\.\d+)"
    texts = re.findall(pattern2, base[1])
    for text in texts:
        result.append(text[0])
        result.append(text[1])      
    print (result)

将被路由到:

/v1/employees/{empid}/reports

此处/my/host/v1/employees/{empid}/reports 是动态的(字母数字),并随请求而变化。 {empid}看起来将有助于匹配网址格式,但是如何将动态值传递给下游?

0 个答案:

没有答案