1

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
  • The ProxyRequests directive should usually be set off when using ProxyPass. Open proxy servers are dangerous both to your network and to the Internet at large. – user67717 Mar 21 '13 at 17:54
2

According to the Apache documentation, if the ProxyTimeout configuration directive is not specified, the global/vhost setting of Timeout is used and in effect. So if the backend is taking longer than Timeout seconds, Apache will close the connection (!).

So even though ProxyTimeout has a default of 300s, you pretty much need to specify it anyway to make sure it is in effect.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.