How to Increase the Maximum File Upload Size in Newired On-Premise

Modified on Fri, 31 Jul at 12:47 PM

This guide explains how to increase the maximum file upload size in a Docker-based Newired On-Premise installation.

The upload limits are configured in an external newired.properties file. The file must then be mounted into the Newired Portal container through docker-compose.yml.


Prerequisites


To perform this configuration, you need:

  • Administrative access to the host running Newired
  • Permission to edit docker-compose.yml
  • Permission to create or edit newired.properties
  • Permission to recreate the Newired Portal container


Configure the Upload Limit


1. Create or edit newired.properties

Create a file named newired.properties in the same directory as the docker-compose.yml file.

To allow the upload of an individual file up to 100 MB, add the following configuration:

spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=110MB
server.tomcat.max-http-post-size=115343360
server.tomcat.max-swallow-size=209715200

Configuration properties

PropertyDescription
spring.servlet.multipart.max-file-sizeMaximum permitted size of one uploaded file.
spring.servlet.multipart.max-request-sizeMaximum size of the complete multipart request, including uploaded files, form fields, multipart headers, and protocol overhead.
server.tomcat.max-http-post-sizeMaximum amount of POST data processed by the embedded Tomcat server. The value is specified in bytes.
server.tomcat.max-swallow-sizeMaximum amount of request data that Tomcat can read and discard after an upload has been rejected. The value is specified in bytes.

The maximum request size should be slightly larger than the maximum individual file size because a multipart request contains additional data besides the uploaded file.

The values in this example correspond to:

Maximum individual file:  100 MB
Maximum complete request: 110 MB
Tomcat POST limit:         110 MiB = 115343360 bytes
Tomcat swallow limit:      200 MiB = 209715200 bytes

When multiple files can be uploaded in one request, increase spring.servlet.multipart.max-request-size so that it can accommodate the combined size of all files.

Mount the Configuration File

In docker-compose.yml, locate the portal service and add or uncomment the following volume mapping:

services:
  portal:
    image: newired-portal:26.2.0
    volumes:
      - ./newired.properties:/opt/external/newired.properties

The complete relevant volume configuration may look similar to this:

services:
  portal:
    volumes:
      # External Newired configuration
      - ./newired.properties:/opt/external/newired.properties

 path on the left side of the mapping is relative to the directory containing docker-compose.yml. The path on the right side is the location from which Newired Portal reads the external configuration.

Important: Make sure that newired.properties exists and is a file, not a directory, before creating the container.

Apply the Configuration

Restart the server so that the new volume mapping and configuration are applied:

docker compose down && docker compose up -d

If the installation uses the legacy Docker Compose command, run:

docker-compose down && docker-compose up -d

Restarting the existing container may not be sufficient when the volume mapping has just been added to docker-compose.yml.


Verify the Configuration


Check that the Portal container is running:

docker compose ps portal

Check the Portal logs for configuration or startup errors:

docker compose logs --tail=200 portal

Then upload a test file slightly below the configured limit, for example a file between 95 MB and 100 MB.

Also verify that a file larger than 100 MB is rejected.

Reverse Proxy and Load Balancer Limits

The effective upload limit is determined by the lowest limit in the complete request path.

When Newired is deployed behind a reverse proxy, ingress controller, web application firewall, or load balancer, its request body limit must also permit the configured upload size.

For example, an NGINX reverse proxy can be configured as follows:

client_max_body_size 110M;

After changing the NGINX configuration, reload or restart NGINX.

Other proxies and ingress controllers have equivalent request-size settings.


Choosing Different Limits


The settings should follow this general relationship:

Maximum individual file size
<
Maximum complete multipart request size
<=
Reverse proxy and infrastructure limits

Example: 50 MB maximum file size

spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=55MB
server.tomcat.max-http-post-size=57671680
server.tomcat.max-swallow-size=104857600

Example: 100 MB maximum file size

spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=110MB
server.tomcat.max-http-post-size=115343360
server.tomcat.max-swallow-size=209715200


Troubleshooting


The upload is rejected before reaching Newired

Check the request-size limit configured in the reverse proxy, ingress controller, web application firewall, or load balancer.

The configuration has no effect

Verify that:

  • newired.properties is mounted into /opt/external/newired.properties
  • The volume mapping is not commented out
  • The file name and path use the correct letter case
  • The Portal container was recreated after changing docker-compose.yml
  • The same properties are not defined with different values in another configuration source

Verify that the configuration file is mounted inside the container:

docker compose exec portal cat /opt/external/newired.properties

Docker creates a directory instead of a file

This can happen when the source file does not exist when the container is created.

Stop the deployment, remove the incorrectly created directory, create the configuration file, and recreate the Portal container:

rm -rf newired.properties
touch newired.properties

docker compose up -d --force-recreate portal

Add the required properties to newired.properties before testing the upload.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article