You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Naaman Musawwir <na...@fourthhousesecurity.com> on 2002/11/11 13:57:10 UTC
Redirection in proxy_http.c
Hi,
How can I redirect the request to some URL in proxy_http.c code. I tried to use an internal redirect as follows:
ap_internal_redirect("http://www.cnn.com", r);
It gives the following error:
proxy: Max-Forwards has reached zero - proxy loop? returned by http://www.cnn.com.
Any ideas? Also, what if I want to do a formal redirect instead of internal redirect?
Thanks,
Naaman Musawwir.
Re: Redirection in proxy_http.c
Posted by Naaman Musawwir <na...@fourthhousesecurity.com>.
> "Naaman Musawwir" <na...@fourthhousesecurity.com> writes:
>
> > Right. In fact, I want to intercept the request in between and want to
> > redirect conditionally to somewhere else instead of where redirected by
> > ProxyPass.
> >
> > BTW where is ProxyPass implemented? I am kind of novice in Apache code
:)
>
> Take a look at function proxy_trans() in modules/proxy/mod_proxy.c.
Thanks, I have looked at that and used the following code to redirect, but
that does not work properly. Only a sub-request gets redirected, but not the
main request. Also this code is called many times when a page is loaded. How
can I stop that? OR should I write this code somewhere else?
if(mycheck) {
r->proxyreq=PROXYREQ_NONE;
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, "%s",
"************** Redirecting");
ap_internal_redirect("http://test.fhs.com/httpa/index.html", r);
return OK;
}
I used this in the function ap_proxy_http_handler() in proxy_http.c.
>
> --
> Jeff Trawick | trawick@attglobal.net
> Born in Roswell... married an alien...
>
Re: Redirection in proxy_http.c
Posted by Jeff Trawick <tr...@attglobal.net>.
"Naaman Musawwir" <na...@fourthhousesecurity.com> writes:
> Right. In fact, I want to intercept the request in between and want to
> redirect conditionally to somewhere else instead of where redirected by
> ProxyPass.
>
> BTW where is ProxyPass implemented? I am kind of novice in Apache code :)
Take a look at function proxy_trans() in modules/proxy/mod_proxy.c.
--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...
Re: Redirection in proxy_http.c
Posted by Naaman Musawwir <na...@fourthhousesecurity.com>.
Hello,
Right. In fact, I want to intercept the request in between and want to
redirect conditionally to somewhere else instead of where redirected by
ProxyPass.
BTW where is ProxyPass implemented? I am kind of novice in Apache code :)
----- Original Message -----
From: "Jeff Trawick" <tr...@attglobal.net>
To: <de...@httpd.apache.org>
Sent: Wednesday, November 13, 2002 2:25 AM
Subject: Re: Redirection in proxy_http.c
> "Naaman Musawwir" <na...@fourthhousesecurity.com> writes:
>
> > Hi,
> >
> > How can I redirect the request to some URL in proxy_http.c code. I tried
to use an internal redirect as follows:
>
> are you talking about the same thing that ProxyPass does?
>
> if so, see how ProxyPass is implemented :)
>
> --
> Jeff Trawick | trawick@attglobal.net
> Born in Roswell... married an alien...
>
Re: Redirection in proxy_http.c
Posted by Jeff Trawick <tr...@attglobal.net>.
"Naaman Musawwir" <na...@fourthhousesecurity.com> writes:
> Hi,
>
> How can I redirect the request to some URL in proxy_http.c code. I tried to use an internal redirect as follows:
are you talking about the same thing that ProxyPass does?
if so, see how ProxyPass is implemented :)
--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...