0

There is a strange problem that we have when we deploy our application on the Azure environment. 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.

Our test and production environments are all on Azure right now. 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. Which leads me to believe that it might be some Azure configuration that I need to change. But don't know what.

It is simple web application on Java, Servlets and running on Tomcat.

hell_storm2004
  • 1,401
  • 2
  • 33
  • 66

1 Answers1

0

Log4j is used as a logging framework for JavaScript with no runtime dependencies. 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; the server might close the connection.

Fix: Under java code -> application.properties add these two lines

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.

reference article for more information and solution.

Swarna Anipindi
  • 792
  • 2
  • 9
  • You are assuming that this is Spring based application. But it is not. It works on my laptop because I have the Connector tag in Tomcat's XML maxPostSize="-1" – hell_storm2004 Jan 18 '23 at 15:16
  • 1
    Yes, the answer referred to Spring based. I have found one more reference tutorial relates to maxpostsize. https://stackoverflow.com/questions/68998529/what-does-maxswallowsize-really-do – Swarna Anipindi Jan 23 '23 at 05:47