我有一个在本地运行良好的节点/快速应用程序。我已将其上传到 Azure Web App,只要我不启用身份验证,它就可以正常工作。当我启用 AAD 身份验证时,应用程序失败并显示状态 500.1011“错误请求”。我的网址中有很多查询参数。如果我充分减少参数的长度,应用程序将再次正常加载。 Azure 中的查询/标头似乎有一些限制?
我已经尝试了几个小时来解决这个问题,但我想我必须承认失败。我想也许this https://stackoverflow.com/questions/11636386/how-to-configure-the-web-config-to-allow-requests-of-any-length会修复它,但看起来并非如此。
这是我当前的 web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<webSocket enabled="true" />
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768" maxUrl="65536"/>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
我想我发现了问题。 Node 将最大标头大小从 80kb 减少到 8kb2018年11月 https://www.nearform.com/blog/protecting-node-js-from-uncontrolled-resource-consumption-headers-attacks/.
关于它有很多讨论here https://github.com/nodejs/node/issues/24692 and here https://github.com/Azure/azure-cosmos-js/issues/221.
我尝试增加 max-http-header-size,但无法使其在 Azure 上运行。所以我现在的解决方案是使用旧版本的节点。希望最终能在这些讨论中提出解决方案。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)