该站点设置在localhost:8080
,反向代理使用localhost:8080/myProxy
.
处理标准链接时,一切都很好。我可以查看代理 url 并按预期查看所有内容。从链接localhost:8080/myProxy/default.aspx
进入localhost:8080/myProxy/about.aspx
预期。
我遇到的问题是,在使用 .NET 的地方Response.Redirect()
,url 更改为网站的实际位置,而不是代理。
即链接来自localhost:8080/myproxy/default.aspx
-> localhost:8080/about.aspx
。
请问我该如何解决?
这是我的配置:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<urlCompression doStaticCompression="false" doDynamicCompression="false"
dynamicCompressionBeforeCache="false" />
<rewrite>
<rules>
<rule name="Reverse Proxy to my site" stopProcessing="true">
<match url="^myProxy/(.*)" />
<action type="Rewrite" url="http://localhost:8080/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script"
pattern="^http(s)?://localhost:8080/(.*)" />
<action type="Rewrite" value="/myProxy/{R:2}" /> …
Run Code Online (Sandbox Code Playgroud)