You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rici Lake <ri...@ricilake.net> on 2005/04/08 17:46:52 UTC

mod_proxy handling of error returns from scheme handlers

Just a query: I was looking at the code for mod_proxy.c and I wonder if 
the behaviour is really correct.

At line 632, it loops through the configured proxy hosts, trying 
proxy_run_scheme_handler on each one. If it receives any return code 
other than DECLINED or HTTP_BAD_GATEWAY, it accepts the result.

But then at line 656, having failed to find a proxy which will handle 
the request, it tries the request directly. In this case, it retries on 
any error return if max_attempts has not been reached. This would cause 
a retry, for example, on an authentication required status return, 
which seems odd.

Perhaps I am missing something.

Rici


Re: mod_proxy handling of error returns from scheme handlers

Posted by Graham Leggett <mi...@sharp.fm>.
Rici Lake wrote:

> I guess it raises the issue of why the direct connection is attempted. 
> Presumably it is possible that all the configured downstream proxies 
> refused to pass on the request to the origin server, but that *this* 
> server succeeds in passing the request to the origin server. In that 
> case, the result could be anything that the origin server returned. No?

The purpose is to cover the case where none of the downstream servers 
are available - remember that it will only retry (or try direct connect) 
on bad gateway - if one of the proxies refused to pass on the request, 
then a proper response code would be returned and the direct path would 
never be attempted.

Regards,
Graham
--

Re: mod_proxy handling of error returns from scheme handlers

Posted by Rici Lake <ri...@ricilake.net>.
On 8-Apr-05, at 1:40 PM, Graham Leggett wrote:

> In theory (if I understand it correctly) it wouldn't - because it 
> would only try the direct connection on DECLINED or bad gateway - if 
> authentication was denied, the result would be neither DECLINED nor 
> bad gateway, and so the direct connection would never be tried in this 
> case.

I guess it raises the issue of why the direct connection is attempted. 
Presumably it is possible that all the configured downstream proxies 
refused to pass on the request to the origin server, but that *this* 
server succeeds in passing the request to the origin server. In that 
case, the result could be anything that the origin server returned. No?


Re: mod_proxy handling of error returns from scheme handlers

Posted by Graham Leggett <mi...@sharp.fm>.
Rici Lake wrote:

> Just a query: I was looking at the code for mod_proxy.c and I wonder if 
> the behaviour is really correct.
> 
> At line 632, it loops through the configured proxy hosts, trying 
> proxy_run_scheme_handler on each one. If it receives any return code 
> other than DECLINED or HTTP_BAD_GATEWAY, it accepts the result.
> 
> But then at line 656, having failed to find a proxy which will handle 
> the request, it tries the request directly. In this case, it retries on 
> any error return if max_attempts has not been reached. This would cause 
> a retry, for example, on an authentication required status return, which 
> seems odd.

In theory (if I understand it correctly) it wouldn't - because it would 
only try the direct connection on DECLINED or bad gateway - if 
authentication was denied, the result would be neither DECLINED nor bad 
gateway, and so the direct connection would never be tried in this case.

Regards,
Graham
--