我想在VirtualService中访问uri的动态值

问题描述 投票:0回答:1

我想部署两个具有不同URL的服务。

 - match:
    - headers:
        location:
          exact: pune
      uri:
        prefix: /pune
    route:
    - destination:
        host: wagholi
        port:
          number: 8080
      uri:
        prefix: /pune/{location}
    route:
    - destination:
        host: yerwada
        port:
          number: 8080
      uri:
        prefix: /pune/{local}/here
    route:
    - destination:
        host: hadapsar
        port:
          number: 8080

在这种情况下,当我将API的位置值作为yerwada传递给API时,得到404 Not Found / pune / yerwada。我也通过/ pune / hadapsar /这里得到相同的错误404 Not Found / pune / hadapsar / here,当我在本地位置通过hadapsar时。 !!!!!

kubernetes routing kubernetes-ingress istio gateway
1个回答
0
投票

请求是否传递名为location的标头,其值为pune?如果为“否”,则将其从匹配规则中删除-这是导致单独使用uri前缀不匹配请求的原因:

    - headers:
        location:
          exact: pune

以防万一,这里是指向relevant doc的链接。

© www.soinside.com 2019 - 2024. All rights reserved.