Fix [HTTP Error] client intended to send too large body [Media Upload WordPress]

HTTP Error” is a frequent error among users of WordPress who use the classic upload method pictures, documents and other files.
Every time we encounter a SQL, HTTP error, it is good to check the logs from the server. They can provide us with more information about the error message displayed in the browser.

Here is an example of an error “HTTP error” in the browser when trying to upload a .PDF file:

The same error, in the server logs it looks completely different. Much more detailed and which leads us more easily to solving the problem. Depending on the configuration of the web server and the HTTP / HTTPS services, the file containing error data can be of the form: error.log, error_log, domain-name.error.log, etc.

 2019/06/10 12:58:14 [error] 25084#25084: *22825511 client intended to send too large body: 1143385 bytes, client: 84.XX.XX.XX, server: stealthsettings.com, request: "POST /wp-admin/async-upload.php HTTP/1.1", host: "stealthsettings.com", referrer: "https://stealthsettings.com/wp-admin/post.php?post=19644&action=edit" 

The error above tells us that the file we want to upload to the server is larger than the limit allowed by the server per upload session. This limit can be found in the general NGINX configuration file (nginx.conf) or in the custom NGINX config file of the domain on which we encountered this limitation.
“HTTP error” appears most of the time when we have a file with I want MB sea or we do simultaneous upload to several files.

How we solve the error “client intended to send too large body – HTTP error”

The simplest method is to edit the file “nginx.conf” and establish a directive to change the upload limit allowed per session. In our case, we set the limit of 10 MB per upload file body.

 client_max_body_size 10M;

The directive above will be added to the http (server/location) section.

We save the file “nginx.conf” edited with “vi” or “nano”, then we test the nginx configuration.

nginx -t

 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 nginx: configuration file /etc/nginx/nginx.conf test is successful

We restart the nginx service:

 service nginx restart

or

 systemctl restart nginx

After these steps, resume the upload process. Everything should go without problems and errors “HTTP error” to disappear.

Many WordPress users with blogs/sites hosted on servers with NGINX are facing this limitation lately. Most likely this limitation comes with the new security features introduced in the latest version of NGINX.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. Fix [HTTP Error] client intended to send too large body [Media Upload WordPress]
Leave a Comment