Using Zope With Apache - The Writing On The Wall (
Page 4 of 7 )
Now, while this is fairly simple, there's one very important caveat with
this method. You won't be able to access the Zope management interface
via PCGI, because Apache has trouble passing authentication headers over
the CGI "bridge" that's been constructed between Zope and itself.
Luckily, there does exist a solution for this (although it comes with a
caveat of its own, discussed on the next page). This solution involves
using Apache's URL rewriting engine to artificially pass the
authorization credentials to Zope over CGI.
In order to do this, first make sure that your Apache build includes
support for URL rewriting (you can do this by looking for
"mod_rewrite.c" in the output of "httpd -l"). If it does, great - skip
the configure-build-install process below and jump straight into
configuring the server. If not, you'll need to recompile Apache with
support for URL rewriting.
First, untar the Apache distribution to a directory on your system.
$ cd /tmp/sources
$ tar -xzvf apache_1.3.20.tar.gz
Next, configure Apache to activate the URL rewriting module.
$ cd /tmp/sources/apache_1.3.20
$ ./configure --enable-module=rewrite
Compile and install the package.
$ make
$ make install
All done? Now add the following lines to Apache's "httpd.conf"
configuration file.
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^/Zope(.*) /usr/local/apache/cgi-bin/Zope.cgi/$1
[e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]
This tells the server to use its URL rewriting engine to automatically
pass all URLs containing /Zope to the "Zope.cgi" script. Simultaneously,
it sets the environment variable HTTP_CGI_AUTHORIZATION to reflect the
current authentication status, thereby (hopefully) solving the
authentication problem.
Restart the server, and try accessing the URL again. This time, Apache
should successfully pass your authentication credentials to Zope, and
you should be able to access the Zope management interface.
If it didn't work, you're not toast yet - flip to the next page for an
alternative solution.