0

我正在尝试让corsanywhere在 Azure 上工作,如果我要求这样的事情,它实际上可以工作:

https://myserver.azurewebsites.net/www.remoteserver.com/query=john

但是,如果我调用它,我会收到 500 错误并且我不知道如何跟踪它(在这种情况下,日志中不会产生错误):

https://myserver.azurewebsites.net/http://www.remoteserver.com/query=john

这种请求在 corsanywhere 演示站点上或者当我在我的开发机器上运行我的节点应用程序时效果很好。

更新:Azure 上的节点需要一个 web.config 文件。这是我的:

<configuration>
<system.webServer>
      <handlers>
        <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
      </handlers>
      <rewrite>
        <rules>
          <rule name="DynamicContent">
             <match url="/*" />
             <action type="Rewrite" url="server.js"/>
          </rule>
        </rules>
      </rewrite>
</system.webServer>
</configuration>

我想知道这是否可能是罪魁祸首...

谢谢你的帮助

4

1 回答 1

1

在 Azure 应用服务 (Windows OS):/中,URL 路径中不允许使用字符。之前在 SO 上讨论过这个问题:Azure 网站在 URL 中有冒号时会抛出 500 错误

您可以尝试@TimBunting 的答案中的解决方案,或者将您的应用程序托管在Linux 应用服务上。

于 2018-02-01T06:53:33.170 回答