[Zope] VirtualHostMonster

Evan Simpson evan@4-am.com
Fri, 9 Feb 2001 13:08:19 -0500


From: Oleg Broytmann <phd@phd.pp.ru>
>    I am not sure. It depends on how VHM is implemented. Does it use
> traversing machinery? Should I use only slashes or can use other
> separators?

It uses __before_traverse__ to check for "VirtualHostBase" and to replace
"VirtualHostRoot" elements with its own Id.  This causes it to be acquired,
and __bobo_traverse__ performs the "VirtualHostRoot" processing.

>    What about the following way:
>
> /VirtualHostBase/http:www.foo.com/Zope:/root/foo_folder/VirtualHostRoot/
>
>    Here go the protocol, hostname, virtual path and zope folder.

The virtual path, zope folder, and the remainder of the path need to be
separated by delimiters, and the virtual path needs some kind of prefix,
since it will often be omitted.  In your example, the ':' is both separating
the paths and indicating that there *is* a virtual path, which seems fragile
to me.

Perhaps the simplest (if a bit awkward) answer, would be something like:

/VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/$
1

In this example, "VirtualHostRoot" processing consumes any following path
elements that start with "_vh_", strip off the prefix, and use the result as
the virtual path. (The "$1" is where the remainder of the path is inserted
by Apache).

Cheers,

Evan @ digicool & 4-am