Re: Corrected: Proxy and rewrite ordering

2006-05-27 Thread Nick Kew
On Saturday 27 May 2006 19:40, Ruediger Pluem wrote:

> Sorry for being confused, but as far as I read the line above mod_rewrite
> runs *before* mod_proxy in the translate_name hook. It actually runs
> *after* mod_rewrite in the fixup hook:

Bah.  [mutter].  Harumph!

Oh well, nevermind.  Serves me right for taking the name and comment
at face value.  Thanks for untangling my poor little braincell.

-- 
Nick Kew


Re: Corrected: Proxy and rewrite ordering

2006-05-27 Thread Ruediger Pluem


On 05/27/2006 02:47 PM, Nick Kew wrote:
> [my previous post contained some irrelevant observations I
> thought I'd deleted.  Reposting to reduce confusion]
> 
> In mod_rewrite.c, I see
> ap_hook_translate_name(hook_uri2file, NULL, NULL, APR_HOOK_FIRST);
> 
> In mod_proxy.c, I see
> /* fixup before mod_rewrite, so that the proxied url will not
>  * escaped accidentally by our fixup.
>  */
> static const char * const aszSucc[]={ "mod_rewrite.c", NULL };
> ap_hook_translate_name(proxy_trans, aszSucc, NULL, APR_HOOK_FIRST);

Sorry for being confused, but as far as I read the line above mod_rewrite runs
*before* mod_proxy in the translate_name hook. It actually runs *after* 
mod_rewrite
in the fixup hook:

ap_hook_fixups(proxy_fixup, NULL, aszSucc, APR_HOOK_FIRST);

And that is what the comment before

> /* fixup before mod_rewrite, so that the proxied url will not
>  * escaped accidentally by our fixup.
>  */
> static const char * const aszSucc[]={ "mod_rewrite.c", NULL };

is about. I admit that this also confused myself.


Regards

RĂ¼diger



Corrected: Proxy and rewrite ordering

2006-05-27 Thread Nick Kew
[my previous post contained some irrelevant observations I
thought I'd deleted.  Reposting to reduce confusion]

In mod_rewrite.c, I see
ap_hook_translate_name(hook_uri2file, NULL, NULL, APR_HOOK_FIRST);

In mod_proxy.c, I see
/* fixup before mod_rewrite, so that the proxied url will not
 * escaped accidentally by our fixup.
 */
static const char * const aszSucc[]={ "mod_rewrite.c", NULL };
ap_hook_translate_name(proxy_trans, aszSucc, NULL, APR_HOOK_FIRST);

What exactly is the risk that's protecting against?  I'd like to run the
mod_rewrite hook before the mod_proxy one, to have the mod_rewrite
environment variables available in proxy_trans.

It looks to me as if the only thing that'll affect that ordering is 
mod_proxy's
if (r->proxyreq) {
/* someone has already set up the proxy, it was possibly ourselves
 * in proxy_detect
 */
return OK;
}

So, presumably it should work if I run two proxy_trans hooks: the
first just makes the above check and returns DECLINED if not;
the second makes the same check but follows it with the
ProxyPass stuff.

Or am I missing something deeper?

-- 
Nick Kew