IIS反向代理不使用ASP.NET中的Response.Redirect()
|
我正在尝试使用教程 here,here和 here设置反向代理. 该站点在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 – >本地主机: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}" />
</rule>
<rule name="RewriteRelativePaths" preCondition="ResponseIsHtml1">
<match filterByTags="A,Script"
pattern="^/(.*)" negate="false" />
<action type="Rewrite" value="/myProxy/{R:1}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
</system.webServer>
解决方法很抱歉回答我自己的问题,但我认为值得为其他人提供信息:使用Response.Redirect时,出站规则开始起作用.使用Fiddler查看请求有助于解决链接发生的问题. Response.Redirect()试图发送到/About.aspx(在响应标头中传输). 正则表达式没有提到这一点. 我需要的唯一出站规则是setting up <rule name="Response Status Update" preCondition="ResponseStatus" stopProcessing="true">
<match serverVariable="RESPONSE_Location" pattern="^/(.*)" />
<action type="Rewrite" value="http://myServer:8080/myProxy/{R:1}" />
</rule>
入境规则保持不变. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net邮件添加ReplyTo
- asp.net-mvc – 如何为MVC创建自定义验证属性
- asp.net-mvc – 在使用WEB API时,如何从POST中提取HttpResp
- asp.net – 使用HtppWebRequest发布表单数据没有效果
- asp.net – IIS HTTP错误500.19
- asp.net-mvc – 部署的ASP.NET MVC 4项目不会运行
- ASP.NET:Response.Redirect(…)后的代码会发生什么?
- asp.net中js+jquery添加下拉框值和后台获取示例
- 如何格式化带有class参数的asp.net webmethod的JSON
- asp.net-mvc – 构建视图模型的最佳方法是什么?
- asp.net-core – 从ActionFilterAttribute设置Vi
- asp.net-mvc-3 – 剃刀引擎 – 如何根据不同的条
- asp.net – 如何告诉RadioButtonList不生成表
- ASP.NET MVC 2中的asp.net-mvc-2 – LazyList vs
- .net – 抱歉,处理您的请求时出错
- 将额外的信息与ASP.NET MVC成员关联
- asp.net – 在IE10中不应该“X-UA兼容IE =边缘”
- iis-7 – 经典ASP站点请求在IIS7中随机挂起
- asp.net-mvc – 模型绑定不起作用
- asp.net-mvc – ASP.NET MVC架构如何适应传统的多
