Zope, VirtualHosts, mod_rewrite and you.
Here's the situation: We use VirtualHosts that look like this: <VirtualHost 127.0.0.1> RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^/(.*) /home/httpd/cgi-bin/Zope.cgi/site1/$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l] </VirtualHost> <VirtualHost 127.0.0.2> RewriteEngine on RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^/(.*) /home/httpd/cgi-bin/Zope.cgi/site2/$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l] </VirtualHost> On the surface, everything rewrites fine. The problem is that for some reason, the rewrite action gets called twice. The first time, it rewrites correctly, and everything looks the way it should. The second time it gets called, it sets the PATH_TRANSLATED to /home/httpd/cgi-bin/Zope.cgi/site1/site1/whatever.html which is causing some problems. So basically, my question is this: Why is the rewrite rule getting called twice? The first time it recognizes it as the initial call, and it calls the second one subreq. I have the rewrite log with RewriteLogLevel set to 9 if anyone wants to see it. Nick Garcia | ngarcia@codeit.com CodeIt Computing | http://codeit.com
Hmm.. there seems to be difference between 1.10.2 and 1.10.3 here... I add a rewrite to strip the highest folder that Zope puts in with it's 'base' tag. I'd love it if there were some <maybe Environment variable?> that would enable virtual hosts to strip stuff out of the Zope base tags. I think I could patch HTTPResponse.py to do that... but I'm wondering if the DC folks would love it..... My solution has to change when switching. It seems that in 1.10.2 this works: <VirtualHost foo.spvi.com> Port 80 ServerAdmin steve@spvi.com DocumentRoot /webroot/sites/test1/ ServerName foo.spvi.com ErrorLog /var/log/foo_error.log TransferLog /var/log/foo_access.log RewriteEngine on RewriteRule ^/foo/(.*) /$1 RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^/(.*) /usr/local/etc/zope/Zope.cgi/foo/$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l] </VirtualHost> but in 1.10.3 I need this..... <VirtualHost foo.spvi.com> Port 80 ServerAdmin steve@spvi.com DocumentRoot /webroot/sites/test1/ ServerName foo.spvi.com ErrorLog /var/log/foo_error.log TransferLog /var/log/foo_access.log RewriteEngine on RewriteRule ^/foo/(.*) /$1 RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule ^(.*) /usr/local/etc/zope/Zope.cgi/foo$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l] </VirtualHost> (notice that there is no '/' after the 'foo' in the last Rewrite) this is apache 1.3.4 -steve
participants (2)
-
ngarcia -
Steve Spicklemire