【发布时间】:2017-06-28 17:49:25
【问题描述】:
我正在尝试使用 ARR 和 URL 重写进行反向代理以实现以下重定向:
显示的最终 URL 将与源 URL 相同。
重定向工作正常,但是在外部浏览时,我所有的 JavaScript 文件都被转换为 content-type text/html 而不是 application/javascript。这会导致空白页而不是实际功能。
重写规则:
<rules>
...
<rule name="ReverseProxyInboundRule2" stopProcessing="true">
<match url="^test(.*)" />
<action type="Rewrite" url="http://{HTTP_HOST}:83/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="IsJavascript">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" customTags="" pattern="^http(s)?://localhost:83/(.*)" />
<action type="Rewrite" value="http{R:1}:{HTTP_HOST}/{R:2}" />
</rule>
<preConditions>
<preCondition name="IsJavascript">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/javascript" />
</preCondition>
</preConditions>
</outboundRules>
目标页面使用 AJAX 功能,并且由于 js 文件被随机 html 标签损坏,导致 AJAX 功能失败。我该如何纠正这个问题?
【问题讨论】:
标签: javascript asp.net iis reverse-proxy arr