【发布时间】:2022-01-12 15:43:24
【问题描述】:
我们的 Dot Net Core 5 托管在 Linux Azure Web App 上,其中包含 Angular 12 Web 应用程序。
this.router.navigate([]).then((result) => {
window.open('/flight/flight-book?flightdata=' + encodeURIComponent(this.encryptData(hiddenvalue)), '_blank');
});
现在上面的代码在浏览器上运行得到一个错误 - HTTP ERROR 414 - URL Too Long 但在 localhost 中运行它工作正常。
我们认为 azure Web 应用正在停止此 URL 以在浏览器上呈现。即使在 web.config 上,我们也提到了以下代码,但仍然无法正常工作。
<system.webServer>
<!-- Here you have other settings related to handlers.-->
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="10485760" maxUrl="1000241" maxQueryString="3002768" />
</requestFiltering>
</security>
</system.webServer>
【问题讨论】:
-
使用表达式
'/flight/flight-book?flightdata=' + encodeURIComponent(this.encryptData(hiddenvalue))生成的导致414错误的URL 的实际长度是多少? -
是的,长度是一个很长的加密字符串——但是在 localhost 上运行一切都很好,只有在 azure web 应用程序上部署后才能获得 HTTP 414。