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