[Zope] authentication & mod_rewrite troubles

Michel Pelletier michel@digicool.com
Thu, 16 Mar 2000 15:33:29 -0800


david harris wrote:
> 
> I cant get to the management screen if I use Apache. I use the correct superuser/password combination which works fine if I go through port 8080. But I get the following:
>  "Zope Error
>  Zope has encountered an error while publishing this resource.
>  Unauthorized
>  You are not authorized to access this resource.
> 
>  **** No Authorization header found. ***
> 
> I cranked up the mod_rewrite loglevel to 9 and got the following  that inicates the module is there and doing *something* ;
> "192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81b4964/initial] (2) init rewrite engine with requested uri /cgi-bin/Zope.cgi/manage
> 192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81b4964/initial] (3) applying pattern '^/Zope/(.*)' to uri '/cgi-bin/Zope.cgi/manage'
> 192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81b4964/initial] (1) pass through /cgi-bin/Zope.cgi/manage

This passes through because /cgi-bin/Zope.cgi/manage does not match the
pattern ^/Zope/(.*)

> 192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81ba994/subreq] (2) init rewrite engine with requested uri /manage
> 192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81ba994/subreq] (3) applying pattern '^/Zope/(.*)' to uri '/manage'
> 192.168.0.2 - - [16/Mar/2000:00:03:51 +0000] [www.test.net/sid#81a9f0c][rid#81ba994/subreq] (1) pass through /manage"

This passes through because /manage does not match the pattern
^/Zope/(.*)

> Im all out of ideas: Zope seems OK so I think it is a config issue - but Im out of ideas. My httpd set up is;
> 
> RewriteCond %{HTTP:Authorization}  ^(.*)
> RewriteRule ^/Zope/(.*) /usr/local/httpd/cgi-bin/Zope.cgi$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]

Your pattern is ^/Zope/(.*).  The ^ means match the beginning of the
'script path'.  So, this pattern will match:

http://www.test.net/Zope/

Keep in mind this will NOT match http://www.test.net/Zope (without a
terminating /).  If you want to match:

http://www.test.net/

The use the pattern ^/(.*)

You many need to play with the initial /s a bit.  Various versions of
mod_rewrite have done this different ways, some versions match ^ up to
the first /, and some don't.

Do note the rewrite documentation at 
http://www.apache.org/docs/mod/mod_rewrite.html

``The great thing about mod_rewrite is it gives you all the
configurability and flexibility of Sendmail. The downside to mod_rewrite
is that it gives you all the configurability and flexibility of
Sendmail.'' 
-- Brian Behlendorf
Apache Group 

`` Despite the tons of examples and docs, mod_rewrite is voodoo. Damned
cool voodoo, but still voodoo. '' 
-- Brian Moore
bem@news.cmc.net 

-Michel