[Zope] virtual hosts with ZServer

Alexander N Gould agould@student.umass.edu
Thu, 15 Jun 2000 18:21:35 -0400 (EDT)


On Wed, 14 Jun 2000, ethan mindlace fremen wrote:

> Hmm.  superuser can't manage the folders? They should be able to.  I assume you
> mean by "almost works" it doesn't let you manage?
> 
<snip>
> Second, once you set this up, you cannot manage the folder except from it's url
> ( host1.penguinpowered.com/manage should work)
> 
> These are kind of stabs in the dark. If you could show me some urls that don't
> work, then maybe I can do some more.
> 

No, even worse!  Here's what I do, and what happens:

Add folders with the names of the subdomains.
Add SiteRoots to each of these folders, with both fields blank as
instructed.
Create a dtml-method at the root level named "virtualhosts" using the
script you provided.
Add a Site Access Rule at the root level linked to the method.
... everything works fine up to here.  A confirmation message appears
saying "You have added a site access rule" or something like that.  Then
when I click on "OK", a dialog comes up saying "Authorization failed,
retry?".  Even the superuser doesn't work.  I try quitting the browser
(Netscape) and accessing the site (using any of the urls -
masspirg.penguinpowered.com, singlepayermass.penguinpowered.com, others),
but the exact same error occurs.  Here is the traceback:

Traceback (innermost last):
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 214,
in publish_module
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 179,
in publish
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 151,
in publish
  File /usr/share/zope/lib/python/Products/SiteAccess/ChangeBehaviors.py,
line 93, in traverse
  File /usr/share/zope/lib/python/Products/SiteAccess/ChangeBehaviors.py,
line 27, in before_traverse
  File /usr/share/zope/lib/python/OFS/DTMLMethod.py, line 150, in __call__
    (Object: virtualhosts)
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: virtualhosts)
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Let.py, line
145, in render
    (Object:
hostname="_.string.join(_.string.split(_.string.split(HTTP_HOST,':')[0],
'.')[0], '')")
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Try.py, line
212, in render
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Try.py, line
221, in render_try_except
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Util.py, line
335, in eval
    (Object: _[hostname])
    (Info: _)
  File <string>, line 0, in ?
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Util.py, line
161, in careful_getitem
Unauthorized: (see above)

Let me clarify some relevant things about my setup.  My server is in my
dorm room, thus is allocated a dynamic IP address through DHCP, also a
random hostname (prin-###.res.umass.edu).  I get around this by
registering some names with penguinpowered.com "dynamic DNS" and
automatically updating them with my IP address when it changes.  Before I
tried this virtual hosts experiment, the system worked just fine -
everyone who tested it could reach masspirg.penguinpowered.com.  I'm
teaching myself this server/content management stuff during this summer as
I work on a groupware-like site that will eventually be moved to a
dedicated server with a better connection.

Thanks for all your help - I'm sure you have much more important things to
do than assisting newbies like myself!
---------------------
Building highways to reduce traffic is like loosening your belt to reduce
obesity