forked from heroku/heroku-buildpack-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix heroku#342: Apache 2.4.39 causes 408 timeout after 20 seconds on …
…long file uploads
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
<Proxy "${heroku-fcgi}"> | ||
# 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 | ||
</Proxy> | ||
|
||
Listen ${PORT} | ||
|
||
<VirtualHost *:${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 | ||
|
||
<Directory "${HEROKU_APP_DIR}"> | ||
# lock it down fully by default | ||
# if it's also the docroot, it'll be opened up again further below | ||
Require all denied | ||
<FilesMatch "^(\.|composer\.(json|lock|phar)$|Procfile$)"> | ||
# explicitly deny these again, merged with the docroot later | ||
Require all denied | ||
</FilesMatch> | ||
</Directory> | ||
# handle these separately; who knows where they are and whether they're accessible | ||
<Directory "${HEROKU_APP_DIR}/${COMPOSER_VENDOR_DIR}"> | ||
Require all denied | ||
</Directory> | ||
<Directory "${HEROKU_APP_DIR}/${COMPOSER_BIN_DIR}"> | ||
Require all denied | ||
</Directory> | ||
|
||
DocumentRoot "${DOCUMENT_ROOT}" | ||
|
||
<Directory "${DOCUMENT_ROOT}"> | ||
Options FollowSymLinks | ||
|
||
# allow .htaccess to do everything | ||
AllowOverride All | ||
|
||
# no limits | ||
Require all granted | ||
</Directory> | ||
|
||
# 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 | ||
<FilesMatch \.php$> | ||
<If "-f %{REQUEST_FILENAME}"> # make sure the file exists so that if not, Apache will show its 404 page and not FPM | ||
SetHandler proxy:fcgi://heroku-fcgi | ||
</If> | ||
</FilesMatch> | ||
|
||
Include "${HEROKU_PHP_HTTPD_CONFIG_INCLUDE}" | ||
|
||
</VirtualHost> |