I suppose you could do multiples with a simple -or- arrangement. Your solution (and mine to some extent) are similar to the SiteRoot examples. My goal was to take the editing of the accessrule out of the picture so I (or others) don't accidentally lock everyone out. The HostsTable accomplishes this nicely. It also allows easy multiple aliasing. thanks.
-----Original Message----- From: M. Adam Kendall [mailto:mak@kha0s.org] Sent: Thursday, March 22, 2001 10:06 PM To: Alan Capesius Cc: zope@zope.org Subject: Re: [Zope] Virtual Hosting configuration for Zope
Alan, I do something similar, but I do it with an access rule only (and adding a simple Site Root to each folder that has all properties blank)
Basically, I have an access rule that looks at the hostname (complete hostname, not just domain name) and then redirects to a properly named folder off the root.
Here is the access rule if you want to take a gander: <dtml-let virtual_dir="_.string.lower(_.string.join(_.string.split(_.string. split(HTTP_HOST, ':')[0],'.')[:],'_'))"> <dtml-if "virtual_dir != 'manager_host_com'"> <dtml-if expr="virtual_dir"> <dtml-call "REQUEST.set('SiteRootPATH', '/')"> <dtml-call "REQUEST['TraversalRequestNameStack'].append(virtual_dir)"> <dtml-else> <dtml-call "REQUEST.set('SiteRootPATH', '/')"> </dtml-if> </dtml-if> </dtml-let>
Basically, what this does is: 1. Grab the hostname, convert to lowercase (for those that are CAPS challenged) and then replace . with _ 2. Look and see if the hostname is the name of our management alias hostname (the hostname designated to be the Zope root, manager.host.com in this case) and if it is, simply do nothing and just continue on normally 3. If it's not our management hostname, then look and see if we have a folder that matches (IE: host_domain_com) 4. If we have a folder that matches, set our SiteRoot stuff, and add the path to the name stack
Simple solution really, and was done before the creation of VHM's in Site Access. I have several servers running with this solution and it works quite well.. The one drawback to this method is the case of wanting more than one site pointed to the same folder. Haven't figured out a complete solution for that yet ;-)
--Adam
On 21 Mar 2001 23:01:26 -0600, Alan Capesius wrote:
I've put together the following solutions for virtual hosting of domains and I'm looking for some feedback from the list.
The solution uses TinyTable, Virtual Host Monster and AccessRule and a DTML method to process all inbound requests by domain name similar to the way in which SiteRoot script things. The best part is that once set, the AccessRule does not need to be modified to add new hosts. Host to folder mapping is performed via entries in the TinyTable, the rest of the configuration is static. I would think it would be simple to implement something like this as a product, though it is beyond my current skill set.