[Zope-dev] Apache Mod_rewrite question

Eugene el-spam at yandex.ru
Wed Jul 14 03:23:51 EDT 2004


Hello Ganesha,
Wednesday, July 14, 2004, 1:40:14 AM, you wrote:

I'm using mod_rewrite with zope but without maps.
Can your describe in details your task?


GS> Hi,

GS> I came across a strange behavior of mod_rewrite while using with zope.
GS> Although it is not a zope question, I was wondering if any of you have
GS> run into this. We are using mod_rewrite to redirect the users to one of
GS> the zope sites of a Zeo cluster.

GS> The directive RewriteMap has unexpected behavior when it is used to
GS> define more than one map with same map name in diffrent places. Normally
GS> all the directives within a tag applies only to that tag. 

GS> For example:

GS> <VirtualHost *>
GS> ServerName   www.foo.com
GS> DocumentRoot /var/www/foo
GS> RewriteEngine on
GS> RewriteLog    /var/log/httpd/foo.log
GS> RewriteLogLevel  2
GS> RewriteMap map rnd:/etc/httpd/conf/foomap.txt
GS> RewriteRule ^/Foo(.*)
GS> http://127.0.0.1${map:IP}/VirtualHostBase/http/foo/$1 [L,P]
GS> </VirtualHost>

GS> <VirtualHost *>
GS> ServerName   www.bar.com
GS> DocumentRoot /var/www/bar
GS> RewriteEngine on
GS> RewriteLog    /var/log/httpd/bar.log
GS> RewriteLogLevel  2
GS> RewriteMap map rnd:/etc/httpd/conf/barmap.txt
GS> RewriteRule ^/Bar(.*)
GS> http://127.0.0.1${map:IP}/VirtualHostBase/http/bar/$1 [L,P]
GS> </VirtualHost>

GS> The above is expected to work. However ModRewrite, does not read the map
GS> file foomap.txt or barmap.txt everytime it needs it and it caches the
GS> results after the first time it reads for faster operation.  

GS> The problem is the cache treats both the file as the same since they
GS> have the same name! Hence if you visit foo.com first, the data stored in
GS> foomap.txt is returned from the cache next time you visit foo.com or
GS> bar.com. This causes apache to redirect into the wrong zope site.

GS> Has anyone else experienced similar problems ? 

GS> thanks,
GS> ganesh

GS> Zeomega LLC
GS> Open minds' Open Solutions

GS> Plano, Texas, USA
GS> Bangalore, India
GS> phone: 972-731-6750
GS> http://www.zeomega.com

GS> _______________________________________________
GS> Zope-Dev maillist  -  Zope-Dev at zope.org
GS> http://mail.zope.org/mailman/listinfo/zope-dev
GS> **  No cross posts or HTML encoding!  **
GS> (Related lists - 
GS>  http://mail.zope.org/mailman/listinfo/zope-announce
GS>  http://mail.zope.org/mailman/listinfo/zope )



-- 
Best regards,
 Eugene                            mailto:el-spam at yandex.ru



More information about the Zope-Dev mailing list