我如何将请求从消费者重定向到我的JS文件到另一个文件夹

How can I redirect a request from consumer to my JS file to another folder

本文关键字:我的 JS 文件 文件夹 另一个 重定向 消费者 请求      更新时间:2023-09-26

我创建了一个名为"MyApp.js"的javascript插件,它托管在example.com/MyApp/(example.com/MyApp/Scripts/MyApp.js)。

我还选择重写javascript文件,使用我在我的web应用程序的配置文件中维护的布尔开关从example.com/Publish/MyApp/MyApp.js引用。

考虑到MyApp.js也被其他几个消费者消费,我想把他们的请求重定向到example.com/Publish/MyApp/MyApp.js而不是example.com/MyApp/Scripts/MyApp.js。

我怎样才能做到这一点?

<rewrite>
  <rules>
    <clear/>      
    <rule name="Redirect JS to another path in publish folder" stopProcessing="true">
      <match url="^Client/scripts/app/controllers/MyController.js" />
      <action type="Redirect" url="/Publish/MyWebsite/MyController.js" />
    </rule>
  </rules>
</rewrite>