1. Home
  2. WordPress
  3. Uploading large files in WordPress with ModSecurity restrictions

Uploading large files in WordPress with ModSecurity restrictions

Uploading large files in WordPress with ModSecurity restrictions can be challenging because ModSecurity is a web application firewall that monitors HTTP requests and responses for malicious activity. It can block certain actions, such as uploading large files, based on its security rules.

In а Zone managed server environment, ModSecurity is in use and therefore you may encounter the following messages when uploading large files (over 1 GiB) to your WordPress application:

Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page

The reason for the message is the ModSecurity configuration, which limits the size of the uploaded file. The limit is set to 1 GiB, and the Apache error logger is displaying an error message:

ModSecurity: Request body (Content-Length) is larger than the configured limit (1073741824)

Why is the restriction set?

This ModSecurity restriction is imposed for the following reasons:

  1. Security: ModSecurity checks all uploaded files for possible threats.
  2. Server load: Uploading large files can significantly increase server load, especially if they are not scanned efficiently.

It is not possible to modify or remove this ModSecurity configuration.

Solution: Chunked Upload

A modern solution for uploading large files is to use the “chunked upload” method with specific plugin, where the file is split into smaller chunks and uploaded to the server in stages. This solution bypasses the size limitation, allowing hassle-free uploads of files up to 100 GB.

Recommended plugin

To simplify the process, we recommend using the following WordPress plugin: Big File Uploads.

Uploading large files in WordPress with ModSecurity restrictions can be fixed with Big Upload Plugin.

Installation instructions:

  1. Log in to your WordPress admin panel.
  2. Navigate to Plugins > Add New.
  3. Search for the Big File Uploads plugin and click Install Now.
  4. Once installed, activate the plugin.
  5. If necessary, configure the plugin according to your needs.

How to use this plugin?

After activating the plugin, larger files can be uploaded directly to the WordPress media library without error messages or restrictions.

Updated on 10. Dec 2024
Was this article helpful?

Related Articles