Resending message because:

A) I forgot to send to the list
B) there's another option that may be easier.

I just tested this so I know it works.

1) Create the file dhandler in your document
root for mysite.com.

2) Add this code:

<%init>
my $arg = $m->dhandler_arg;
$m->redirect("http://mysite2.com/$arg";);
</%init>

3) Make sure all the directories you
want to have forwarded are empty.

With this, your rewrite rules will work
properly if the user requests the directory
and the dhandler will pass the request string
off to mysite2.com if the user puts in an
html file or something that mason tries to
execute.

This should fix you up.  (Read below for my 
original message if you are so inclined.)

-E

-----------------------

The reason ( probably ) that this error is occurring
is because Mason is trying to execute the component
BEFORE Apache attempts any sort of rewrite.

Easiest fix: change all URL's pointing to these pages
to not use .html.

Second Easiest Fix:  Change your the Apache LocationsMatch
option to ONLY use Mason for the exact files that you want.

Most Difficult Fix: Get rid of the idea of rewrite all
together.  Set decline_dirs to 0 and start using Mason
for all your local requests.  Then, instead of using rewrite
rules in your httpd config, use dhandlers and $m->redirect
to handle all your redirections.

I'd be happy to continue helping until you get something
working.  However, without actually being able to poke
around in your configs and actually be able to test out
various requests to the server, most of the 'I KNOW WHATS WRONG'
stuff is all mostly just speculation.

Good luck,

-E

Diona Kidd (2005-12-07, 18:01):
> correction.
> 
> http://myserver.com/spanish/* gets rewritten to http://myserver2.com/*
> 
> 
> Diona Kidd wrote:
> 
> >I hope that someone will take the time to read this and help. I'm a 
> >bit stumped. If I've posted this to the incorrect list, please advise. 
> >This seems to be some combo of mod_perl, apache and Mason.
> >
> >--------------------
> >
> >I have two apache instances running with Mason and mod_perl. I'm 
> >rewriting urls from a subdirectory from instance #1 to instance #2. 
> >For instance, http://myserver.com/spanish/* gets rewritten to 
> >http://myserver2.com/spanish/*
> >
> >This seems to work fine unless the url is a direct path to say 
> >http://myserver.com/spanish/index.html. In this case, the request 
> >doesn't go to the http://myserver2.com/spanish/index.html. Instead, I 
> >am getting a mason error like below from http://myserver.com. On the 
> >other hand, if I take the same url and replace the server name, it's 
> >fine. So I know it's not the second apache instance. I think it's the 
> >way the request is being proxied.
> >
> >[Mason] Cannot resolve file to component: 
> >proxy:http://myserver2.com/products/index.html (is file outside 
> >component root?) at 
> >/usr/local/lib/perl5/site_perl/5.6.1/HTML/Mason/ApacheHandler.pm line 
> >847.
> >
> >However, my rewrite log for http://myserver.com is reporting:
> >
> >rewrite /spanish/products/index.html -> 
> >http://myserver2.com/products/index.html
> >forcing proxy-throughput with http://myserver2.com/products/index.html
> >go-ahead with proxy request 
> >proxy:http://myserver2.com/products/index.html [OK]
> >
> >I can see that Mason is trying to resolve 
> >'proxy:http://myserver2.com/products/index.html' as a component path 
> >on http://myserver.com, but this doesn't happen when the url path is 
> >to a directory (like /products/). Instead, the request is forwarded 
> >and the proper content is returned. I get similar rewrite entries in 
> >the log in this second case.
> >
> >This is an example entry in the rewrite log for the second case:
> >
> >rewrite /spanish/products/ -> http://myserver2.com/products/
> >forcing proxy-throughput with http://myserver2.com/products/
> >go-ahead with proxy request proxy:http://myserver2.com/products/[OK]
> >
> >Apache: 1.3.26 w/mod_perl < 1.99
> >Mason: 1.31
> >
> >--------------------------------------------------------------
> >Rewrite Config from http://myserver.com httpd.conf
> >--------------------------------------------------------------
> >       RewriteEngine on
> >       RewriteLog "/home/httpd/html/myserver/logs/rewrite.log"
> >       RewriteLogLevel 3
> >
> >       RewriteCond   %{HTTP_REFERER}   http://myserver.com/spanish(.*)
> >       RewriteRule   ^/images/(.*)$    http://myserver2.com/images/$1  
> >[P,L]
> >       RewriteRule   ^/css/(.*)$    http://myserver2.com/css/$1  [P,L]
> >       RewriteRule    ^/spanish/(.*)$  http://myserver2.com/$1  [P,L]
> >
> >       ProxyPassReverse /espanol/ http://myserver2.com/
> >
> >       PerlAddVar MasonCompRoot "private => 
> >/home/httpd/html/myserver/components"
> >       PerlAddVar MasonCompRoot "main => 
> >/home/httpd/html/myserver/webroot"
> >       PerlSetVar MasonDataDir  "/home/httpd/html/myserver/mason"
> >----------------------------------------------------------------------------------
> > 
> >
> >
> >
> >Any ideas?
> >
> >Thanks in advance,
> >
> >Diona Kidd
> 

Reply via email to