[Zope] hiding zope behind an apache proxy with mod rewrite

stephen farrell stephen@farrell.org
03 Feb 1999 15:48:51 -0600


I want to hide zope on a internal site behind apache using mod rewrite
and mod proxy of apache.  The trick is that I want anything in
/cgi-bin/ to go to apache, and anything else to go to Zope... but I
want everything to appear to come from port 80 on the external server.

I'm using ZopeHTTPServer.  Here's what I've gotten apache to do (which 
seems to work OK):

RewriteEngine On
RewriteRule ^/cgi-bin(.*) /cgi-bin/$1 [L]
RewriteRule ^/(.*) http://some.internal.host:2734/$1 [P]
  
But the problem I'm facing is that zope writes all the URLs to
http://some.internal.host:2734/whatever, instead of what they are
supposed to appear as (http://www.mycompany.com/whatever).  How do I
tell zope that I want the urls to look like www.mycompany.com, and not 
to the internal site?  (Preferably only to the outside world; I'm
happy with the inside world using the internal URL).

I've also tried setting SERVER_NAME and SERVER_PORT when zope is
started, and then defining something like: 

MyURL to 
http://<!--#var "REQUEST['SERVER_NAME']"-->:<!--#var "REQUEST['SERVER_PORT']"--> 

which is all well and good, but then how do I get Zope to use this as
the base? Setting <base href="<!--#var MyURL-->"> didn't appear to do
the right thing....  I want stuff like URL0, URL1 etc to work.

Or, alternatively, is there a better way to accomplish what I want?
What it comes down to is that I want apache around to run stuff in
/cgi-bin on port 80 on the master server (critical), but I want zope
to serve the documents on port 80 on the master server.  I don't want
/cgi-bin/zope.cgi?whatever either on the URL if it can be avoided. 

One thought I had was to use wget or similar to do a recursive get on
the entire zope site, and then publish staticly.  Does this sound like 
a good idea?

(sorry for the rambling email--i'm very tired =)

--

Steve Farrell