简体   繁体   English

节点服务器的请求路径中的http或https创建错误

[英]http or https in request path to a node server creates an error

I am trying to make corsanywhere work on Azure, and actually it works if I request something like this: 我正在尝试使corsanywhere在Azure上正常工作,并且如果我要求类似以下内容,则实际上可以正常工作:

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

But if I call this, I get a 500 error and I don't know how to track it (no error is produced in the logs in this case): 但是,如果我打电话给我,我会得到500错误,并且我不知道如何跟踪它(在这种情况下,日志中不会产生错误):

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

This kind of request works well on the corsanywhere demo site or when I run my node app on my dev machine. 这种请求在corsanywhere演示站点上或在我的开发机上运行节点应用程序时都能很好地运行。

Update : Node on Azure needs a web.config file. 更新 :Azure上的节点需要一个web.config文件。 Here is mine: 这是我的:

<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>

I am wondering if this could be the culprit... 我想知道这是否是罪魁祸首...

Thanks for your help 谢谢你的帮助

In Azure App Service (Windows OS), the characters :/ are not allowed in the URL path. 在Azure App Service(Windows OS)中,URL路径中不允许使用字符:/ This was discussed on SO before: Azure websites throw 500 error when there is a colon in the URL . 之前在SO上对此进行了讨论: URL中的冒号时,Azure网站抛出500错误

You could try a solution in @TimBunting's answer, or host your application on a Linux App Service instead. 您可以尝试使用@TimBunting的答案中的解决方案,也可以将应用程序托管在Linux App Service上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM