tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cos...@eng.sun.com>
Subject Re: Multi-homing/Virtual named hosts
Date Sat, 01 Apr 2000 16:34:39 GMT
Richard Vowles wrote:

> Ok, I spent a bit of time examining SimpleMapper and ContextManager and the
> current mechanism for doing the lookup and it looks like it will take some
> serious changes to support virtual hosts without doing some silly butchering
> (as Costin indicates).
>
> I _could_ prepend a virtual hostname onto the string key that is used for
> ContextManager.getContext(path) but that appears to be a remarkably ugly
> mechanism. Here are my thoughts:
>
> 1) It would appear that VirtualHosts would need to be defined inside the
> ContextManager section of the server.xml file, this is what was in mind?

Probably that's a good solution - what I had in mind was looking at apache
( or other servers ) config and try to match. I know, there is no standard
config
file format ( and tomcat doesn't even need a "format" - server.xml is just one
way to configure tomcat in a simple case ).

Probably a new element <VirtualHost name="foo" ip="192.168.4.1" ... >
would be better. ( we can and should keep the XML model distinct from
the object model - the XML is designed for users, it's a "document", but
it can't dictate the program implementation ).

> 2) It appears that ContextManager would need to be changed to handle
> anything other than a simple path - was this expected?

Context yes, I don't see the problem with ContextManager - it doesn't care
about virtual hosts, it just deals with Request/Responses.

ContextManager is the "controler" - it just maintain the collection of Contexts
( without knowing the semantics or relation between contexts), the
collection of interceptors ( that will know how to manipulate Req/Resp and
Contexts) and the adapters. It doesn't have to know about what's inside
Context or Request.


> 3) The ServerName property can appear un fully qualified, which means that
> either (a) the server would need to fully qualify a domain name requested
> (which shouldn't be too nasty as the name service mechanism on the local
> machine should have cached it) or (b) require partial matching. Which should
> be supported? I think partial matching will slow it down.

I don't know - we should check with existing implementations ( like apache).

> 4) The Ajp12 (and others?) handler would then need to be fixed to get the
> right context, as the context is being derived solely from the path, and
> moved later on when the server name is found.

No problem - it's done. The virtual host is already there, and all web servers
we support (Apache, IIS, NES ) can deal with virtual hosts.

I think ( but haven't tried ) you can get tomcat+apache to support virtual
hosts with only few line-changes and a smart configuration. If you set
up httpd.conf with virtual hosts and servlets inside then you'll have the
information (virtualhost and location) sent to tomcat. It will be very easy
to skip any mapping and just use that info.

This may be a very good starting point - we can learn a lot from this.
( at least that's how I would start ...)

Costin


Mime
View raw message