Apache proxying to Unicorn server times out, how to avoid

apache-2.2ruby-on-railsunicorn

I have a Teambox installation running on Unicorn, and the latter sometimes times out after 30 seconds. The idea of this configuration would be for Apache to wait until the Unicorn master server sends a timeout, because if I'm not wrong, Unicorn will quit the timed-out worker process but spawn a new one to handle the same request.

Is there a way to configure Apache to not timeout like the nginx configuration of timeout = 0?

Thanks for the help!

EDIT

I found a way, though it doesn't really work as I expected. In the ProxyPass directive you have to specify a retry=0 option after the url:

ProxyPass / http://url/ retry=0

It doesn't work if the url is a ProxyBalancer though.

Best Answer

There is a ProxyTimeout option in Apache, which will allow you to increase the time that Apache will keep the proxy connection open.

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxytimeout has more information about the option.

I guess it would be better to try and diagnose why the connection is timing out in the first place though.