Setting timeout for all the ProxyPass mappings in Apache Server mod_proxy directive

apache-2.2mod-proxy

What I have and works:

I'm using Apache HTTPD 2.2 for proxy requests. I have multiple ProxyPass mappings:

ProxyRequests On 
<Proxy *>
AddDefaultCharset off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost Off

ProxyPass /a http://some_ip/
ProxyPassReverse /a http://some_ip/

ProxyPass /b http://some_other_ip/
ProxyPassReverse /b http://some_other_ip/

...

This works well.

What I want:

Some of my requests are taking longer, so they timed out giving me a Proxy Error – Reason: Error reading from remote server.

I want to set timeout for all of my requests. Can I do this without having to add timeout=... KeepAlive=On for every ProxyPass mapping?

I currently have something like:

ProxyPass /a http://some_ip/ timeout=1200 KeepAlive=On
ProxyPassReverse /a http://some_ip/

ProxyPass /b http://some_other_ip/ timeout=1200 KeepAlive=On
ProxyPassReverse /b http://some_other_ip/

... and i do this for all my ProxyPass mappings

Can I tell Apache in some way to add timeout and KeepAlive parameters for all the mappings? Thanks in advance.


Edit: I also tried using the mod_reqtimeout directive directly, but it did not do the trick for me:

LoadModule reqtimeout_module modules/mod_reqtimeout.so

RequestReadTimeout header=1200 body=1200

Best Answer

I've managed to find a solution by my own. You can set the timeout using directly the ProxyTimeout directive of mod_proxy :

ProxyRequests On 
<Proxy *>
    AddDefaultCharset off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost Off

ProxyTimeout 1200