[英]HTTP 413 Error When App is Deployed on Azure
There is a strange problem that we have when we deploy our application on the Azure environment.当我们在 Azure 环境中部署我们的应用程序时,会遇到一个奇怪的问题。 When I start the application on my laptop, no Azure, no Docker or anything, on sending requests (which is a little bit big), I don't face any issues.当我在我的笔记本电脑上启动应用程序时,没有 Azure,没有 Docker 或任何发送请求(有点大),我没有遇到任何问题。
Our test and production environments are all on Azure right now.我们的测试和生产环境现在都在 Azure 上。 So when the application is deployed on it, I get this strange error:因此,当在其上部署应用程序时,出现了这个奇怪的错误:
log4javascript error: AjaxAppender.append: XMLHttpRequest request to URL ./common/logToServer.jsp?controllerName=6c3eaf3e-897d-4b30-a15e-62f9d3d3ce78 returned status code 413
Now I know what HTTP 413 error code is, but not sure, why my local is not showing the same error.现在我知道 HTTP 413 错误代码是什么,但不确定为什么我的本地没有显示相同的错误。 Which leads me to believe that it might be some Azure configuration that I need to change.这让我相信我可能需要更改一些 Azure 配置。 But don't know what.但不知道是什么。
It is simple web application on Java, Servlets and running on Tomcat.它是简单的 web 在 Java、Servlets 上的应用程序并在 Tomcat 上运行。
Log4j is used as a logging framework for JavaScript with no runtime dependencies. Log4j 用作 JavaScript 的日志记录框架,没有运行时依赖性。 As per the error statement, the issue was caused by the length of the payload, which is too large.根据错误说明,问题是由有效负载的长度过大引起的。
The HTTP status code 413 ("Payload Too Large") indicates that the request entity is larger than the limits defined by the server; HTTP状态码413(“Payload Too Large”)表示请求实体大于服务器定义的限制; the server might close the connection.服务器可能会关闭连接。
Fix: Under java code -> application.properties add these two lines修复:在 java 代码下 -> application.properties 添加这两行
server.tomcat.max-swallow-size=***MB //maximum size of the request body/payload
server.tomcat.max-http-post-size=*** MB //maximum size of entire POST request
NOTE: *** is your desired integer representing megabyte.注意:*** 是您想要的代表兆字节的 integer。
reference article for more information and solution.参考文章以获取更多信息和解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.