Javascript 内容类型在 URL 重写后更改

Javascript content type being changed after URL Rewrite

我正在尝试使用 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 功能失败。我该如何纠正?

最终确定问题是由于目标应用程序中的相对路径引起的。代理后,js、css 和其他链接将重定向到自定义 404 错误页面,该页面是源应用程序的一部分。我已经通过修改代码解决了这个问题。