You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Abd El-Hamid Mohammed <ha...@egypt.com> on 2002/08/29 20:39:02 UTC

Redirecting through proxy

Hi,
   Anybody can tell me how to redirect
http://www.mydomain.com/abc To http://abc.mydomain.com:8080

I had used the following

RewriteEngine on
RewriteRule ^/abc(.*) http://abc.use-trade.com:8080$1 [P]
ProxyPass /abc/   http://abc.use-trade.com:8080/
ProxyPassReverse /abc/ http://abc.use-trade.com:8080/

and it works great for redirecting http://www.mydomain.com/abc/
but it fails with http://www.mydomain.com/abc "without the trailing slash"
as the first page is the only page that displays correctly, Any link in it
is prefixed with http://www.mydomain.com/ which is wrong as it should be
http://www.mydomain.com/abc/

Can anyone tells me how to solve it.

Abd El-Hameed


Re: Redirecting through proxy

Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Thu, 29 Aug 2002, Abd El-Hamid Mohammed wrote:

> RewriteEngine on
> RewriteRule ^/abc(.*) http://abc.use-trade.com:8080$1 [P]
> ProxyPass /abc/   http://abc.use-trade.com:8080/
> ProxyPassReverse /abc/ http://abc.use-trade.com:8080/
>
> and it works great for redirecting http://www.mydomain.com/abc/
> but it fails with http://www.mydomain.com/abc "without the trailing slash"
> as the first page is the only page that displays correctly,

Because then it proxies http://www.mydomain.com/abc to
http://abc.use-trade.com:8080 - you need to add a rewrite rule in
the proxy for redirecting /abc to /abc/

  RewriteRule ^/abc /abc/ [R,L]


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();


Re: Redirecting through proxy

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Thu, 29 Aug 2002, Abd El-Hamid Mohammed wrote:

>    Anybody can tell me how to redirect
> http://www.mydomain.com/abc To http://abc.mydomain.com:8080
> 
> I had used the following
> 
> RewriteEngine on
> RewriteRule ^/abc(.*) http://abc.use-trade.com:8080$1 [P]
> ProxyPass /abc/   http://abc.use-trade.com:8080/
> ProxyPassReverse /abc/ http://abc.use-trade.com:8080/
> 
> and it works great for redirecting http://www.mydomain.com/abc/
> but it fails with http://www.mydomain.com/abc "without the trailing slash"
> as the first page is the only page that displays correctly, Any link in it
> is prefixed with http://www.mydomain.com/ which is wrong as it should be
> http://www.mydomain.com/abc/
> 
> Can anyone tells me how to solve it.

You can add
RewriteRule ^/abc$ http://abc.use-trade.com/abc/ [R]
to send redirect to browser from /abc to /abc/
as mod_dir does for any directory without trailing slash.

BTW, mod_accel send such redirection automatically, i.e if you have

AccelPass  /one/    http://backend/two/

then if browser ask /one it will get redirect to /one/.

Igor Sysoev
http://sysoev.ru