iis反向代理规则使用相同的虚拟目录失败

iis反向代理规则使用相同的虚拟目录失败,iis,reverse-proxy,Iis,Reverse Proxy,我有两个网址 第一个类似于:localhost1/api/test/2.0/aaa 第二个类似于:localhost2/api/test/3.0/aaa 当使用localhost1/api/test/3.0/aaa时,我希望重写为localhost2/api/test/3.0/aaa。 我的重写映射:原始值是localhost1,新值是localhost2 我的入站规则是api/(.+)/3.0/(.+),url匹配是https://{C:0}/api/{R:1}/3.0/{R:2} 当我使用l

我有两个网址

第一个类似于:localhost1/api/test/2.0/aaa

第二个类似于:localhost2/api/test/3.0/aaa

当使用localhost1/api/test/3.0/aaa时,我希望重写为localhost2/api/test/3.0/aaa。 我的重写映射:原始值是localhost1,新值是localhost2

我的入站规则是api/(.+)/3.0/(.+),url匹配是https://{C:0}/api/{R:1}/3.0/{R:2}

当我使用localhost1/api/test/3.0/aaa时 我总是从localhost1/api/test/2.0/aaa得到响应,但我真正想要的是 localhost2/api/test/3.0/aaa 请告诉我怎么修

(注意:如果使用localhost1/api/test2/3.0/aaa,我可以从localhost2/api/test2/3.0/aaa获得正确的响应,但存在locahost1/api/test)


谢谢。

据我所知,C:0将匹配条件模式,而不是入站模式。此外,我发现您编写规则只是为了匹配
localhost1/api/test/3.0/aaa
而不是
api/test/2.0/aaa

如果您想让2.0也重写到localhost2,我建议您可以添加以下url重写规则

            <rule name="Teeee">
                <match url="api/(.+)/2.0/(.+)" />
                <action type="Rewrite" url="https://localhost2/api/{R:1}/2.0/{R:2}" />
            </rule>

我只想使用3.0重写到另一个url。