Configuring WildFly upload file size

If you implement a file upload in your web front end and want to send the data to the WildFly with HTTP POST, the WildFly will put a stop to it as soon as a certain file size is exceeded. The default value for the size of a POST request is 10MB.


So how to configure WildFly upload file limit ? In order to do that, change the max-post-size attribute in the undertow subsystem:


The value for max-post-size is expressed in bytes.

That command will result in the following configuration:

 <subsystem xmlns="urn:jboss:domain:undertow:3.0">  
            <buffer-cache name="default"/>  
            <server name="default-server">  
                <http-listener name="default" max-post-size="25485760" redirect-socket="https" socket-binding="http"/>  
                <host name="default-host" alias="localhost">  
                    <location name="/" handler="welcome-content"/>  
                    <filter-ref name="server-header"/>  
                    <filter-ref name="x-powered-by-header"/>  

You can also disable the max post size limit by setting the max-post-size parameter to 0. Run the following CLI command:


Finally, it’s worth mentioning that, if you are running a Front-End Web server (such as Nginx), you have to apply your configuration there.

As an example, to set in http block which affects all server blocks (virtual hosts), add the following configuration to Nginx:

http {
    client_max_body_size 100M;

Related articles: Using REST Services to manage download and upload of files