我在IIS中具有以下规则。
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:3000/{R:1}" />
</rule>
</rules>
我的Web应用程序内部调用另一个域www.anotherdomain.com/somepage
。我的问题是重定向时,它将URL更改为www.mycurrentdomain.com/somepage
,这显然会导致404页。可以请一个人帮我写下正确的规则。
注意-重定向是从应用程序代码res.redirect('www.anotherdomain.com/somepage')
开始
https://www.bing.com
)的示例。您可以根据实际需要进行更改。 <system.webServer>
<rewrite>
<outboundRules>
<rule name="MyLocationRule" preCondition="IsRedirection">
<match serverVariable="RESPONSE_Location" pattern="https://www.bing.com/" />
<action type="Rewrite" value="http://{HTTP_HOST}/webform2.aspx" />
</rule>
<preConditions>
<preCondition name="IsRedirection">
<!--301,302 Url redirection http status code.-->
<add input="{RESPONSE_STATUS}" pattern="3\d\d" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
随时让我知道问题是否仍然存在。