general

An extremely frustrating Apache error – uploads failing silently at exactly 20 seconds

RequestReadTimeout header=300-360,MinRate=500 body=300-360,MinRate=500                                                                                                                        

The above block of text took hours to find, and nearly drove me crazy. I’ve been working on getting file uploads to work on an AWS PHP application sitting behind an Application Load Balancer, and we simply could not figure out the issue. At first, we investigated PHP settings like post_max_size, upload_max_filesize, session.gc_maxlifetime, and I even started trying to strace the httpd process to see what was going on. No matter what changes we made, either in .htaccess or directly in php.ini, the upload would get to a certain size (~30MB) and then fail. At first, file size seemed to be the challenge, however in retrospect since the upload bandwidth was relatively consistent, it would make sense that the issue occurred when the uploaded file reached around the same file size.

In the end, the inclusion of mod_reqtimeout in Apache HTTPd 2.4 was the culprit, and the line above allowed for larger files to be uploaded.

More information on mod_reqtimeout and how to increase debugging on it is available here:
https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.