[Zope] Virtual host admin under Apache+ZServer+SiteAccess

ethan mindlace fremen mindlace@digicool.com
Mon, 05 Jun 2000 20:18:03 -0600


J M Cerqueira Esteves wrote:

> However, I'm using Apache with ZServer and SiteAccess for virtual
> hosting as documented in http://www.zope.org/Members/anser/apache_zserver,
> and this has a nasty implication: once I activate a SiteRoot inside some
> Zope folder "/parrot" for making it the top folder of a virtual host
> http://parrot.bar/, the use of URLs under http://parrot.bar/ is forced
> whenever administering content under the "/parrot" folder, even if
> arriving from a foo.bar:8080 document: the browser is then no longer
> connecting through the secure channel but talking directly with
> http://parrot.bar/.  Of course this could also be redirected, but not so
> easily.
> 
> In this example, it would be nice to be able to administer the contents
> of http://parrot.bar/ either via parrot.bar (typically for less
> sensitive content, end users) or via foo.bar:8080 (more delicate
> administrative tasks, administrators which know how to encrypt
> communication with ssh).  Is there interest (or is it feasible) to make
> virtual hosting support evolve to allow this? 

You can do it now with a properly formed siteaccess rule.  I think this
code works, but I don't know if Zope "sees" localhost or foo.bar :
change as necessary.

Get the hostname:
<dtml-let hostname="_.string.join(_.string.split(HTTP_HOST,
':')[-2:-1])">
 <dtml-if "hostname='foo.bar'">
  <dtml-if "1+(_.string.find(PATH_INFO, 'manage'))">
   <dtml-call "REQUEST.set('SiteRootBASE','http://foo.bar:8080/')">
   If we're managing /parrot, make sure to reset the SiteRootPATH
   <dtml-if "1+(_.string.find(PATH_INFO, 'parrot'))">
    <dtml-call "REQUEST.set('SiteRootPATH','/parrot/')">
   </dtml-if>
  </dtml-if>
 </dtml-if>
</dtml-let>

At this point you need to leave SiteRootBASE & PATH blank in all folders
and set them programmatically with the Access Rule. You could probably
generalize this.

~emf
Zopista Community Liason