Category: Tutorials
The problem: Uploading an Image in WordPress showed HTTP Error
I was working on a blog post and decided to include an animated GIF image in addition to the YouTube video in the blog post.
The gif was shortened to 40 seconds and was around 20MB. When the browser finished sending the data WordPress showed HTTP Error.
I had seen this error but it was years ago and was due to memory issues [ not mine by server memory issues ;) ]. The server couldn't allocate enough memory to process the images especially if they are large.
I've increased the memory limits to 256MB and the error still showed up. There was nothing in the WordPress' debug.log file either.
I've even increased the max_execution_time and max_input_time to 60 and 90 seconds respectively.
I have tried whitelisting /wp-admin/async-upload.php both when it's accessed via POST request and via GET but that didn't work either.
Solution (Temporary Workaround) - whitelist your own IP
To to add your IP to the whitelist go to this:
Wordfence > Firewall > Whitelisted IP addresses that bypass all rules
Add your (hopefully static) IP there.
You can find it by going to http://ipchicken.com
Note: If your IP changes often you'll have to keep adding it from time to time unless this (bug) is fixed.
How did I found that it was Wordfence blocking the requests to the async file upload file?
I've opened developer tools in Chrome (by pressing F12) and noticed 403 error which is the code access forbidden.
I clicked on the request and then to the Preview tab and saw the content and that revealed that Wordfence was blocking the requests to that specific file.
I am sure the Worfence team had a good reason to block the requests to this file.
The website is running WordPress multisite not sure if that has to do with it.
I have tested some of these solutions as well and they might work in your case.
- https://wordpress.stackexchange.com/questions/59763/how-to-fix-http-error-when-uploading-images
- https://docs.presscustomizr.com/article/229-fixing-errors-when-uploading-images-in-wordpress