Proxy timeout with Lucee, Apache 2.4 and Tomcat 8.x

Akitogo Team, 09 Jun 2017

This is more a quick note than a decent blog post. Recently there was a question on CFML Slack channel where a user received a Proxy Timeout 502 from Apache which looked like this

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /index.cfm/yourUrl.

Reason: Error reading from remote server


Apache/2.4.18 (Ubuntu) Server at x.x.x.x Port 80

This is easy to fix, so look for your apache2.conf, on Ubuntu do 

sudo vi /etc/apache2/apache2.conf

Your mod_proxy.c section probably looks like this, while Timeout and Proxytimeout are missing. Add both and set suitable values in seconds. You might need to add as well ProxyBadHeader Ignore. While increasing timeouts for internal or test servers makes sense I do not recommend to do this on web facing production servers. If you have long running requests think about threading or external processing.

<IfModule mod_proxy.c>
Timeout 2400
ProxyTimeout 2400
ProxyBadHeader Ignore
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$$1$2
ProxyPassMatch ^/(.+\.cfchart)(/.*)?$$1$2
ProxyPassMatch ^/(.+\.cfml)(/.*)?$$1$2
# optional mappings
#ProxyPassMatch ^/flex2gateway/(.*)$$1
#ProxyPassMatch ^/messagebroker/(.*)$$1
#ProxyPassMatch ^/flashservices/gateway(.*)$$1
#ProxyPassMatch ^/openamf/gateway/(.*)$$1
#ProxyPassMatch ^/rest/(.*)$$1
ProxyPassReverse /