VirtualHost resource

Martijn de Vries writes:
 > Hi, 
 > 
 > While trying to set up a localhost for use with the MirrorDirectory
 > resource, i came accross a problem.
 > 
 > How can i configure it?
 > 
 > w3c.jigsaw.root.name = VirtualHost

This is to be done through the properrty editor
(/Admin/Properties). Note that although Jigsaw will let you think
thachange happens on the fly, this is *not* the case, you have to
restart it (after saving your property changes).

 > I added w3c.jigsaw.resources.VirtualHostResource as 'VirtualHost'. This
 > works fine. Now i configure the resource's attributes and i set followup
 > to 'root'.
 > 
 > When i click on 'followup' a page explaining the VirtualHost resource
 > shows up. Nothing about 'follow-up' is mentioned. What it does mention is
 > a 'hosts' item. There's help for the hosts item, but the 'hosts' item is
 > not in the attributes list. 
 >
 > When i look at the source for the VirtualHostResource, i see that three
 > attribute attribute identifiers are created. Only one of them is actually
 > registered, namely 'followup'. The attributes 'hosts' and 'directory' (not
 > mentioned in the manual, have no idea what it is) are not registered,
 > although they do have an attribute identifier.
 >

Argh ! The doc is out of sync, sorry...
The hosts attrbute was there some time ago and has disapeared, but
let's start with 'followup'. The followup attribute should provide the
name of the resource to use when a request comes in with for host name
that has not yet been registered. 
To register a virtrual host, you just have to Add Resource in your
VirtualHostresource (exactly as for DirectoryResource), it is highly
recommended that you use PassDirectory resources (only) as children of
the VirtualHostResource. Anyway, if your plan is to use
MirrorDirectory, here is what you should do:

say your host is x.y.com, and you want to mirror target.a.com. Create
a VirtualHostResource, say "virtual"; Add to it a MirrorDirectory (and
config it to mirror target.a.com), give it the name "localhost". Set
followup to "root".

Set the server's root resource to "virtual", now:

http://localhost/XXX -> mirrors http://target.a.com/XXX
http://x.y.com/Admin -> provides access to the config

(of course you may want to alias the serving host, so that you can
accesss the mirror through that alias rather then through
localhost). Note that the name under which you add resources into
virtual should be the full virtual hostname (eg it can/should be
"localhost:8001")
 
 > I'm not sure if anyone else has tried using VirtualHost already, maybe i'm
 > doing something complety wrong, but i see no way setting 'host--->resource' 
 > mappings. 

I hope this helps, let me know how it goes. I did all this before the
release (as a check), and it did work...

Anselm.

Received on Wednesday, 23 October 1996 03:08:32 UTC