Iis 将文件夹的规则重写到其他主机
有两个应用程序在本地网络上运行: 主机标题: , 在另一台服务器上,已经为url重写设置了网站。站点的主机标头为 以下是web.config的内容:Iis 将文件夹的规则重写到其他主机,iis,url-rewriting,arr,Iis,Url Rewriting,Arr,有两个应用程序在本地网络上运行: 主机标题: , 在另一台服务器上,已经为url重写设置了网站。站点的主机标头为 以下是web.config的内容: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://ui.local/{R:1}" />
</rule>
</rules>
</rewrite>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
去
然而,我想写另一条规则,以便请求。。。。将转发给。。。相反
如何为这种情况编写规则 您可以使用以下规则:
<rule name="redirect api" stopProcessing="true">
<match url="api/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://api.local/api/{R:1}" />
</rule>
<rule name="all redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
<action type="Redirect" url="http://ui.local/{R:1}" />
</rule>
注意:确保API规则应该是第一条规则。在此规则之上添加一条新规则,在其中添加一个条件以检查URL是否以API
开头。