Iis 代理规则问题

Iis 代理规则问题,iis,arr,Iis,Arr,我需要使用ARR在IIS中创建代理重写 因此: 我有两台服务器: https://server1.com https://server2.com 现在,在每一个文件夹中,我都有一个虚拟文件夹 https://server1.com FilesFolder https://server2.com FilesFolder 我在server2中保存了文件 比如: 现在我需要当我打开chrome时 https://server1.com/FilesFoler/users-profi

我需要使用ARR在IIS中创建代理重写

因此:

我有两台服务器:

https://server1.com
https://server2.com
现在,在每一个文件夹中,我都有一个虚拟文件夹

https://server1.com
    FilesFolder

https://server2.com
    FilesFolder
我在server2中保存了文件

比如:

现在我需要当我打开chrome时

https://server1.com/FilesFoler/users-profile/test.png
我想把这个请求转到

https://server2.com/FilesFoler/users-profile/test.png
现在,我为服务器1执行了代理规则:

测试1:

<rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="https://server2/{C:0}" />
                    <conditions>
                        <add input="{URL}" pattern="/users-profile/.*" />
                    </conditions>
                </rule>
            </rules>

但我打开的工作窗口:

然后我尝试另一个规则

测试2

 <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="https://server2/FilesFolder/{C:0}" />
                    <conditions>
                        <add input="{URL}" pattern="/users-profile/.*" />
                    </conditions>
                </rule>
            </rules>

这仍然不起作用


这里怎么了

在这种情况下,如果您的请求是正确的

当IIS处理条件模式时

而不是

因此,请将[C:0}替换为{R:1}或{R:0}

   <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="https://server2/{R:0}" />
                    <conditions>
                        <add input="{URL}" pattern="/users-profile/.*" />
                    </conditions>
                </rule>

由于您没有为server2使用ssl卸载。请确保server2使用的是受信任的证书,否则,ARR和server2之间的ssl握手可能会失败

如果出现404错误,请记住在IIS管理器->服务器节点->应用程序请求路由缓存->启用代理中启用代理设置

   <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="https://server2/{R:0}" />
                    <conditions>
                        <add input="{URL}" pattern="/users-profile/.*" />
                    </conditions>
                </rule>