[Zope] small zope <-> apache improvement/suggestion

Thomas Dunne (Sys. Admin.) dunne@dpunkt.de
Sat, 14 Apr 2001 13:04:39 +0200 (CEST)


Hey!

I just spent a "bit of a long time"  trying to get apache to pass through
the HTTP_Auth Headers to the zope pcgi-wrapper. 
(obviously I was doing something wrong ;) )

well to make a long story short:
the suggested apache conf setup for using zope with pcgi and w/o fastcgi
in the file doc/WEBSERVER.txt (line 300) is at the moment:

      # Zope configuration maps /Zope/ to the Zope.cgi CGI script
      RewriteEngine on
      RewriteCond %{HTTP:Authorization}  ^(.*)
      RewriteRule ^/Zope(.*) /usr/local/apache/cgi-bin/Zope.cgi/$1 [e=HTTP_CGI_A
UTHORIZATION:%1,t=application/x-httpd-cgi,l]

as also mentioned in the file, that is one long (and a bit ugly) rewriterule.
Disadvantages of this approach:
 1. only applies when header contains an "Auth-Tag" (surprise!)
 2. creates small havock and some confusion with the already defined
    ScriptAlias line, in that one doesn't definitely know if only
    the ScriptAlias or also the RewriteRule are being applied 
 3. it's a really long line

alternative suggestion:
 * drop the ScriptAlias line
 * drop the unnecessary RewriteCond-query
 * always apply the RewriteRule
 * split the RewriteRule into 3 lines :)

the result then:

  RewriteEngine on
  RewriteRule ^/(.*)$  /var/www-edit/cgi-bin/zope.dpunkt.de/zope/$1
  RewriteRule ^(.*)$   $1  [e=HTTP_CGI_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^(.*)$   $1  [t=application/x-httpd-cgi,l]

a bit nicer to read, and (thank God) it works :)

best wishes + great software!
 tom


__________________________________________________
save the whales, feed the hungry, free the mallocs