From e7b0a2ab89eed7c913adfbb9ef59f51515b3a774 Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Thu, 13 Jun 2019 01:43:32 +0200 Subject: [PATCH] Fix #342: Apache 2.4.39 causes 408 timeout after 20 seconds on long file uploads --- CHANGELOG.md | 4 ++ conf/apache2/2/4/39/heroku.conf | 73 +++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 conf/apache2/2/4/39/heroku.conf diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f9e0721..e99dcff61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - Composer/1.8.6 [David Zuelke] +### FIX + +- Bug in Apache 2.4.39 (https://bz.apache.org/bugzilla/show_bug.cgi?id=63325) causes 408 timeout after 20 seconds on long file uploads (#342) [David Zuelke] + ## v156 (2019-05-30) ### ADD diff --git a/conf/apache2/2/4/39/heroku.conf b/conf/apache2/2/4/39/heroku.conf new file mode 100644 index 000000000..596b76c52 --- /dev/null +++ b/conf/apache2/2/4/39/heroku.conf @@ -0,0 +1,73 @@ +# workaround for bug in 2.4.39 only, see https://bz.apache.org/bugzilla/show_bug.cgi?id=63325 +RequestReadTimeout handshake=0 header=20-40,MinRate=500 body=20,MinRate=500 + +# define a short-hand to our fcgi proxy, for convenience +# Define heroku-fcgi fcgi://127.0.0.1:4999 +Define heroku-fcgi unix:/tmp/heroku.fcgi.${PORT}.sock|fcgi://heroku-fcgi + +# make sure the proxy is registered with the unix socket; we can then use just "fcgi://heroku-fcgi" in proxy and rewrites directives +# we have to do this because we can't rewrite to a UDS location and because PHP doesn't support the unix:...|fcgi://... syntax +# this is also a lot more convenient for users +# http://thread.gmane.org/gmane.comp.apache.devel/52892 + + # we must declare a parameter in here or it'll not register the proxy ahead of time + # min=0 is an obvious candidate since that's the default value already and sensible + ProxySet min=0 + + +Listen ${PORT} + + + + ServerName localhost + + ErrorLog /tmp/heroku.apache2_error.${PORT}.log + # redefine "combined" log format so includes can overwrite it + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" heroku + CustomLog /tmp/heroku.apache2_access.${PORT}.log heroku + + TraceEnable off + + + # lock it down fully by default + # if it's also the docroot, it'll be opened up again further below + Require all denied + + # explicitly deny these again, merged with the docroot later + Require all denied + + + # handle these separately; who knows where they are and whether they're accessible + + Require all denied + + + Require all denied + + + DocumentRoot "${DOCUMENT_ROOT}" + + + Options FollowSymLinks + + # allow .htaccess to do everything + AllowOverride All + + # no limits + Require all granted + + + # mod_proxy doesn't forward the Authorization header, must fix that ourselves + SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1 + + # pass requests to .php files to mod_proxy_fcgi + # this requires Apache 2.4.10+ and PHP 5.5.15+ to work properly + + # make sure the file exists so that if not, Apache will show its 404 page and not FPM + SetHandler proxy:fcgi://heroku-fcgi + + + + Include "${HEROKU_PHP_HTTPD_CONFIG_INCLUDE}" + +