Javascript 角度和URL重写捕获反向代理调用

Javascript 角度和URL重写捕获反向代理调用,javascript,angularjs,mod-rewrite,Javascript,Angularjs,Mod Rewrite,我在Angular.js应用程序中使用Accusoft的文档查看器。获得他们服务的唯一方法是在我的一个目录上使用反向代理设置。因此,我设置了“pas服务”,其中包含一个web.config,如下所示: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules>

我在Angular.js应用程序中使用Accusoft的文档查看器。获得他们服务的唯一方法是在我的一个目录上使用反向代理设置。因此,我设置了“pas服务”,其中包含一个web.config,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:3000/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

它只是重定向到index.html页面,而不是返回调用服务的结果。有什么想法吗?

你试过只使用一套重写规则吗?不要使用两个单独的规则文件,只需在主文件中添加如下内容:

<rule name="PasRewriteRule" stopProcessing="true">
  <match url="^(.*[/])pas-service/(.*)$" />
  <conditions>
  </conditions>
  <action type="Rewrite" url="http://localhost:3000/{R:2}" />
</rule>

在其他规则之前,将其添加到顶部,以确保它首先匹配。然后,您可以删除Accusoft pas服务文件夹。请注意,您可能需要调整正则表达式,因为我不确定应用程序的确切设置

http://localhost/jbv/pas-service/Page/q/0?DocumentID=uZcjEtW-7NshOyh8iEIFCx-EbvHyIAuha6D7tbQvV77O_FKs_P-3KN7rB9McjnnisxhPFv1Wy0f7K4t_Hc0Cc6A&Scale=1&ContentType=svga
<rule name="PasRewriteRule" stopProcessing="true">
  <match url="^(.*[/])pas-service/(.*)$" />
  <conditions>
  </conditions>
  <action type="Rewrite" url="http://localhost:3000/{R:2}" />
</rule>