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

"HTTP Error"Is a common error among users WordPress using the classic upload method photos, documents, and other files.
Every time we encounter an SQL, HTTP error, it's a good idea to check the logs on the server. They can give us more information about the error message displayed in the browser.

Here's an example of an "HTTP error" error in the browser when trying to upload a .PDF file:

The same error in server logs looks altogether different. Much more detailed and easy to move the solution to the problem. Depending on the web server configuration and HTTP / HTTPS services, the file containing error data can be in the form of: error.log, error_log, domainname.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 above error tells us that the file we want to climb on the server is higher than the allowed server limit per upload session. This limit is routed to the general configuration file NGINX (nginx.conf) or in the custom NGINX config file of the domain that we encountered.
"HTTP error" occurs most of the times when we have a file with large MB volume or we do upload simultaneously to multiple files.

How to fix the "client to send too large body" error - HTTP error

The simplest way is to edit the "nginx.conf"And set a directive to change the allowed upload limit per session. In our case we set the limit of 10 MB per upload body files.

client_max_body_size 10M;

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

We save the file "nginx.conf" edited with "vi" or "nano", then 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

Restart nginx service:

service nginx restart

or

systemctl restart nginx

After these steps, resume the upload process. Everything should go smoothly and the "HTTP error" error disappears.

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

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

About the author

Stealth

Passionate about everything that means gadget and IT, I am pleased to write on stealthsettings.com from 2006 and I love to discover new things about computers and macOS, Linux operating systems, Windows, iOS and Android.

Leave a Comment