[Zope-CMF] Subdomain in folder in CMF site

Tres Seaver tseaver at zope.com
Thu Nov 6 08:49:05 EST 2003


On Thu, 2003-11-06 at 03:21, Gitte Wange wrote:

> I want to achieve to have another domain pointing at a folder in my CMF site 
> but still have access to the above CMF Site, the skins, tools etc. And I'm 
> pretty sure if I put a SiteRoot object in my folder, then the folder will not 
> have access to the above CMF Site etc. Right ?
> So I was asking if anyone had tried it and how they solved it.

I know for a fact that the approach works:  requests for the virtual
domain can still acquire the tools from the "hidden" CMFSite.  In our
case, rather than VHM, we use a pair of access rules, which decide
whether to activate based on the presence of the 'Via:' header (set by
Squid for the "retail" view). 

The first access rule is an ExternalMethod root of the ZMI, with
source::

    def redirect( self ):

        """ Move all requests over to /CMS/site
        """
        request = self.REQUEST
        header = request.get( 'HTTP_VIA' ) # Set by Squid

        if header: # Served from the squid cache tier
            request[ 'TraversalRequestNameStack' ].extend(
                                       ( 'site', 'CMS' ) )

The second access rule is another EM, in the 'site' folder::

    def rewrite( self ):

        """ Make the current folder the virtual root.
        """
        request = self.REQUEST
        header = request.get( 'HTTP_VIA' ) # Set by Squid

        if header: # Served from the squid cache tier
            request.setVirtualRoot( [] )

Obviously, this will need tweaking if you aren't serving the virtual
domain behind Squid ;).

Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com




More information about the Zope-CMF mailing list