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

"HTTP Error”Is a common error among users of 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 is an example of the "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" most often occurs when we have a file with large MB volume or we do upload simultaneously to multiple files.

How to resolve "client intended to send too large body - HTTP error" error

The easiest way 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 body of upload files.

client_max_body_size 10M;

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

We save the "nginx.conf" file 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 run smoothly and the "HTTP error" should disappear.

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 gadget and IT, I write with pleasure on stealthsettings.com since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment