gpt4 book ai didi

azure - 使用 Azure APIM 策略获取策略中指定的 url 部分

转载 作者:行者123 更新时间:2023-12-02 16:54:18 25 4
gpt4 key购买 nike

是否可以在策略内获取下面指定的 url 部分:

<policies>
<inbound>
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
<find-and-replace from="https://thirdparty/certs"
to="@(specified url part)" />
</outbound>
<on-error>
<base />
</on-error>
</policies>

请注意,整个 URL 可能包含版本控制和前缀。

最佳答案

整个 URI(假设 https://contoso.com/myapi/.wellknown/openid-config )由以下部分组成:

  1. 方案:context.Request.OriginalUrl.Scheme
  2. 主机:context.Request.OriginalUrl.Host
  3. 可选端口:context.Request.OriginalUrl.Port
  4. API 后缀:context.Api.Path
  5. 操作路径:其余部分

因此,URL 的操作部分可以通过以下方式计算:context.Request.OriginalUrl.Path.Trim('/').Substring(context.Api.Path.Trim('/').Length )

关于azure - 使用 Azure APIM 策略获取策略中指定的 url 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57098928/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com