Apache 1.3.24 + mod_proxy + mod_rewrite + mod_perl problem

Apache 1.3.24 + mod_proxy + mod_rewrite + mod_perl problem

Post by Mauri » Mon, 01 Jul 2002 00:28:19

Hi there!

I've got a problem using mod_proxy and mod_rewrite.
The following snippet is working just fine and Apache
also uses its proxy for _internal_ pages
(*.one.localhost und two.localhost are on the same server
using the same instance of Apache!!).

Rewri*gine On
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^(.*)\.one\.localhost/(.*) http://www.veryComputer.com/$2 [P]

So when I access http://www.veryComputer.com/
will be actually fetched from http://www.veryComputer.com/
No problem.

But unfortunately I have to implement some more advanced rules
for which I cannot use the "RewriteRule whatever [P]" thing.
That's why I've made an Apache module using Perl to access
mod_proxy _directly_ (with that "proxy-server" handler).

The main part looks something like this:

if ($uri is sth. like *.one.localhost/whatever) {

  my $uri = "http://www.veryComputer.com/;;

  return OK;


This works *only* if $uri is an external page like
http://www.veryComputer.com/. It does *not* work for
http://www.veryComputer.com/!! Probably because this domain
is running on the same machine using the same instance
of Apache.

Any ideas of how I can solve this problem? I really
need to proxy _internal_ pages, too.

I thought that there might be a possibility to access the
Rewri*gine somehow from the Perl module... because
this problem does *not* occur with mod_rewrite as written.

Thanx and bye bye,