xml - 如何在 IIS ARR 响应中重写 API 内容
问题描述
主页加载后,我的 Web 应用程序进行了辅助 API 调用。此 API 调用包含带有 URL 的 XML 数据,这些数据也需要重写,但不会被重写。
来自 API 调用的 XML 响应中的 URL 都需要重写为与调用来自的外部域相同的域。
我尝试过使用前提条件<add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/xml" />
和使用前提条件<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
两者似乎都不起作用。
使用的配置如下:
<rule name="ReverseProxyOutboundRule1">
<match filterByTags="None" pattern="^http(s)?://k2.denallix.com/(.*)" />
<conditions>
</conditions>
<action type="Rewrite" value="https://k2.reverseproxy.com/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/xml" />
</preCondition>
</preConditions>
Failed Request Tracing 没有错误,但 GENERAL_RESPONSE_ENTITY_BUFFER 显示 XML 中的响应没有重写 URL。
多个实例<Data>https://k2.denallix.com/Runtime/Runtime/View/Authorization+view/?SN=408849_21</Data>
实际上应该重写为<Data>https://k2.reverseproxy.com/Runtime/Runtime/View/Authorization+view/?SN=408849_21</Data>
谢谢。
解决方案
推荐阅读
- xslt - 无论如何,我们可以在将文件转换为 .csv 格式时防止删除前导零吗?
- c# - C#:Dbreader 值未在循环中更新
- javascript - 如何让某些角色运行 discord.js 命令?
- r - 重新编码后如何使列名像“X_re”?
- javascript - 在 React Native 应用程序中使用我的 SVG 上的 Stroke CSS 属性
- spring-boot - 如何在模块的 Spring Boot 配置类中使用 @AutoConfigureOrder
- c# - 如何使用 MIP SDK 应用水印(Microsoft 信息保护)
- jenkins - Jenkins服务器启动问题
- angular - Firestore 组查询不起作用权限被拒绝
- javascript - Gatsby 模式弃用警告:推断的解析器