Re: Corrected: Proxy and rewrite ordering
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
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
[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
Proxy and rewrite ordering
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); Now, mod_rewrite's hook_uri2file sets r->proxyreq = PROXYREQ_REVERSE if it activates a [P], and mod_proxy's proxy_trans 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