【问题标题】:Configure multiple base paths in APIGEE在 APIGEE 中配置多个基本路径
【发布时间】:2021-02-02 18:54:21
【问题描述】:

我想知道我们是否可以在 APIGEE 中为代理端点配置多个基本路径。两个基本路径的目标代理保持不变。

示例:我想确保 /hello/world 和 /hello/universe 路由到相同的目标端点,并且完全以相同的方式处理

    <HTTPProxyConnection>
        <BasePath>world</BasePath>
        <BasePath>universe</BasePath>
        <VirtualHost>hello</VirtualHost>
    </HTTPProxyConnection>

如何达到同样的效果?

【问题讨论】:

    标签: apigee


    【解决方案1】:

    &lt;VirtualHost&gt; 字段应指 Apigee 虚拟主机,它是完全限定域名 ('FQDN')。这是一个类似于 demo.api.company.com 的主机名。例如,第一个 / 之前的所有内容。

    您的代理基本路径是 /hello,如下所示:

    <BasePath>hello</BasePath>
    

    然后您的 API 代理定义的其余部分使用流和路径匹配条件来处理您想要在 /hello/world 与 /hello/universe 中操作的不同方法

    <Flow name="world_GET">
                <Description>World GET</Description>
                <Request>
                    <Step>
                        <Name>World01</Name>
                    </Step>
                    <Step>
                        <Name>World02</Name>
                    </Step>
                </Request>
                <Response/>
                <Condition>((proxy.pathsuffix MatchesPath "/world") and (request.verb = "GET"))</Condition>
            </Flow>
            <Flow name="universe_GET">
                <Description>Uni GET</Description>
                <Request>
                    <Step>
                        <Name>Uni01</Name>
                    </Step>
                    <Step>
                        <Name>Uni02</Name>
                    </Step>
                </Request>
                <Response/>
                <Condition>((proxy.pathsuffix MatchesPath "/universe") and (request.verb = "GET"))</Condition>
            </Flow>
    

    见: https://docs.apigee.com/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-proxyendpointconfigurationelements

    【讨论】:

      猜你喜欢
      • 2011-08-19
      • 1970-01-01
      • 2022-10-05
      • 2021-02-01
      • 2018-11-04
      • 2014-03-03
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      相关资源
      最近更新 更多