httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Park <>
Subject mod_proxy timeouts
Date Mon, 04 Feb 2008 21:39:29 GMT
According to the description of the ProxyTimeout directive, this
is the expected behavior:

> This directive allows a user to specifiy a timeout on proxy requests.
> This is useful when you have a slow/buggy appserver which hangs, and
> you would rather just return a timeout and fail gracefully instead
> of waiting however long it takes the server to return.

However, this is not what occurs.  The ProxyTimeout is only used
to obtain the connection to the 'origin server'; when it actually
sends the proxied request and waits for the response, the value of
the Timeout directive is used.

Unfortunately, mod_proxy uses a core function called 'pre_connection'
after the connection has been made (despite the 'pre' in the function
name :D) and therein lies the problem.  That code only has access to
the server config, not the modules configs, and it resets the timeout
to the value of the Timeout directive.

My fix is to reset the timeout *after* the call to pre_connection if
this directive is set.

I also added new functionality allowing a special environment
variable ("proxy-timeout") to be set to overload the directive for
more fine-grained control.  This would allow the following:

ProxyTimeout 15

RewriteRule ^/proxy/(.*)$$1

RewriteRule ^/quick/(.*)$$1 \

RewriteRule ^/slow/(.*)$$1 \

This allows three different proxies timeouts to the same origin
server ( based on the URL to the forward

Attached is my patch to 2.0.63 to the proxy_http.c file in


View raw message