Regarding issues caused by the ProxyErrorOverride directive (Apache2.4 - mod_proxy_fcgi)

  • The usage of the ProxyErrorOverride directive is not without causing us any headeache.

    • When the ProxyErrorOverride directive is set to off, the default error handler is not involved when trying to access an inexistent PHP script. instead, we get a blank page.
    • When the ProxyErrorOverride directive is set to on, the default error handler get involved even when that is not expected. That is really bad for PHP applications that provide their own handler for error pages, or even worse when an API send a regular HTTP code such as 404, 403, 503 ...

    I searched a bit for a viable alternative and I ended with something like this:

    1. <Proxy "unix:/var/run/php5-fpm-domain.tld.sock|fcgi://domain.tld" retry=0>
    2. ProxySet connectiontimeout=5 timeout=7200
    3. </Proxy>
    4. RewriteEngine On
    5. RewriteCond %{REQUEST_URI} \.ph(p[3457]?|t|tml)$
    6. RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
    7. RewriteRule (.*) - [H=proxy:fcgi://domain.tld,NC]

    So here, the fix is quick simple, we set the handler for PHP only when the file exists. This seem to solve all issues. This should not prevent any application to catch any URL to /index.php. I'll test a bit further and if ok, I'll add that fix in version 1.3.9. Of course, with that fix, the ProxyErrorOverride directive must be set to off.

    See also:


  • A fix has been added in the 1.3.x branch. See…ad40d724d9c364f3096bee57c
    This fix will be part of i-MSCP version 1.3.9