'Uploading a file bigger than 10mb - Apache 2.4 and JBoss EAP 7 connected via Mod_JK
I am receiving a "Bad Gateway The proxy server received an invalid response from an upstream server" error while trying to upload a 20MB file.
The problem starts in pre-production when I access the page via Apache. Any file over 10MB gives the above error. The Apache and JBOSS are configured via MOD_JK.
There is nothing in the Apache Log whereas in the JBOSS log there is an error "org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. UT000020: Connection terminated as request was larger than 10485760"
If I access the JBOSS directly bypassing Apache web server, the file is uploaded successfully. I changed the maxpostsize in the JBOSS undertow subsystem which made is possible to load via JBOSS.
I wanted to know what is the equivalent of "maxpostsize" directive in Apache Web server? There is some default configuration limiting the file upload size to 10MB in Apache. I just want to increase that limit.
Any help would be appreciated.
Regards,
Solution 1:[1]
You have to edit your Jboss / Wildfly Settings in standalone.xml In Subsystem Undertow you have to set max-post-size="" parameter (default = 10485760) in your used Listener (http-listener default) When you'r using AJP Connection to Apache you have to set this parameter in ajp-listener
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" socket-binding="ajp" max-post-size="104857600" />
...
Example for 100MB max File Size and using ajp-listener
Solution 2:[2]
Adding max-post-size to ajp-listenner solved the issue when I run JBoss in domain mode.
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" max-post-size="104857600" socket-binding="ajp"/>
Solution 3:[3]
Increase max-post-size (10485760 = 10MiB by default) on your listeners in the undertow subsystem to accept large file post requests. For example, setting max-post-size to 31457280 (= 30MB):
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" max-post-size="31457280" socket-binding="ajp"/>
<http-listener name="default" max-post-size="31457280" socket-binding="http" redirect-socket="https"/>
<https-listener name="https" max-post-size="31457280" socket-binding="https" security-realm="ApplicationRealm"/>
...
</server>
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DeaconFrost2k |
| Solution 2 | Jerry |
| Solution 3 | Soheil vaghefi |
