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])(/.*)?$ http://127.0.0.1:8888/$1$2 ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ http://127.0.0.1:8888/$1$2 ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2 # optional mappings #ProxyPassMatch ^/flex2gateway/(.*)$ http://127.0.0.1:8888/flex2gateway/$1 #ProxyPassMatch ^/messagebroker/(.*)$ http://127.0.0.1:8888/messagebroker/$1 #ProxyPassMatch ^/flashservices/gateway(.*)$ http://127.0.0.1:8888/flashservices/gateway$1 #ProxyPassMatch ^/openamf/gateway/(.*)$ http://127.0.0.1:8888/openamf/gateway/$1 #ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1 ProxyPassReverse / http://127.0.0.1:8888/ </IfModule>