geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Virtual Hosts
Date Mon, 16 Jan 2006 17:06:39 GMT
OK, it strikes me as pretty silly that you can't configure virtual
hosts in a common way for web applications, but you can for EJBs
exposed as web services!

My understanding of the problem here is that Tomcat can only take a
single virtual host name, while Jetty can take many.  That name for
Tomcat corresponds to a HostGBean which may be listening on any number
of IPs, but no two hosts can listen on the same IP.  Jetty does not
use that same Host concept -- instead you can list any number of
virtual hosts and the web app will be bound to each of those with no
intermediary.

Right now, there's separate, container-specific virtual host
configuration for Tomcat and Jetty -- even the elements are named
differently.

My problem is that we're taking this fairly common functionality, and
making it hard to use the simple case (1 virtual host name) because we
can't adequately model the difficult case (where you want to bind an
app to multiple virtual hosts and Tomcat has restrictions that Jetty
doesn't).  But again, we managed to make the simple case simple for
EJBs exposed via the web container, so I'm sure we can do it for web
apps.

I propose we do this:

 * Add a 0-or-1 <virtual-host> element to geronimo-web, immediately
before the container-config element
 * Leave the existing 0-N <virtual-host> element in geronimo-jetty-config
 * Leave the existing 0-N <virtual-host> element in geronimo-jetty,
ensuring it's the first "container-specific" element in that file (so
it essentially overrides the 0-or-1 element in the generic plan with a
0-N element)
 * Remove the <host> element from geronimo-tomcat-config and geronimo-tomcat
 * In Jetty, we'll use all the virtual-host elements you provide (up
to 1 in the generic plan and up to N in the container-config or
Jetty-specific plan)
 * In Tomcat, if any Host GBean has the same name (as in name="foo" in
the ObjectName) as the virtual-host name, then we'll bind the web app
to that.  Otherwise, if any Host GBean is bound to the host name/IP
specified as the virtual-host name, then we'll bind the web app to
that (or throw an error).  Otherwise, we'll automatically create and
deploy a new Host GBean using the name of and binding to whatever you
specified in the virtual-host element.

That should mean we have a common configuration scheme if you want to
bind a web app to a single virtual host.  If you want to bind to
multiple virtual hosts, you must either use the extended
Jetty-specific syntax, or manually configure a Host GBean for Tomcat
that binds to those IPs and then put the name of that GBean in the
virtual-host element.

Most importantly, if you do no extra configuration but put
"<virtual-host>virtual.host.com</virtual-host>" in the geronimo-web
plan then it will do what you expect, regardless of the web container
in question.

Would that work for everyone?

Thanks,
    Aaron

Mime
View raw message