geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Genender <jgenen...@apache.org>
Subject Re: Virtual Hosts
Date Mon, 16 Jan 2006 21:48:37 GMT


Aaron Mulder wrote:
> OK, let me try to concoct a still more explicit example, to help me
> understand what's going on in Tomcat.
> 
> Let's say your box as one network card, and, of course, the loopback address:
> 
> lo
> eth0
> 
> With 2 IPs assigned to the network card:
> 
> lo
>   127.0.0.1
> eth0
>   192.168.1.12
>   192.168.1.13
> 
> And each of those IPs has two host names assigned:
> 
> lo
>   127.0.0.1
>     localhost
> eth0
>   192.168.1.12
>     clubs.cards.com
>     spades.cards.com
>   192.168.1.13
>     diamonds.cards.com
>     hearts.cards.com
> 
> Now we have one Tomcat listener by default:
> 
> Listener HTTP @ 0.0.0.0
>   127.0.0.1
>     localhost
>   192.168.1.12
>     clubs.cards.com
>     spades.cards.com
>   192.168.1.13
>     diamonds.cards.com
>     hearts.cards.com
> 
> And we have one Tomcat Host by default:
> 
> Host TomcatHost, name=localhost
>   127.0.0.1
>     localhost
> 
> So as far as I can tell, in our default configuration, since the only
> Tomcat Host GBean is given a name parameter of "localhost", we only
> support virtual hosting for "localhost" without additional user
> configuration (deploying Host GBeans)? 

Yes. this is correct.

> Or do we only support any
> traffic at all to "localhost"?  I haven't tried Tomcat from a remote
> machine.

If the host is set up as localhost, this gets all traffic to 127.0.0.1.
 This is the loopback interface which generally means it can handle all
traffic to all interfaces as long as a connector that listens to the
0.0.0.0 is set...which in your example, it is.


> 
> Anyway, let's say I have two applications, "Poker" and "Pinochle", and
> I want Poker to be available on hearts.cards.com and spades.cards.com,
> and I want Pinochle to be available on spades.cards.com and
> clubs.cards.com.  Is that possible?  

No.  First differentiate the IP with what VH is answered to.  In this
situation, you shouldn't even set up connectors to listen on the IP
addresses.  The single 0.0.0.0 connector will suffice.

Second, all Tomcat should care about is to answer to the URL.  That is
the deciding factor.  DNS will do its job and resolve the IP address to
get to Tomcat in the first place.  Tomcat will have 0.0.0.0 on the
connector and allow it through.  Tomcat will then decide on the host
based on URL.

You are requesting that Poker listen on hearts and spades and Pinochle
only listen on spades and clubs.  This is an invalid entry since Poker
cannot be attached to 2 hosts at once.

The only way I could possibly seeing this scenario work on TC is to have
a single host and filter based on a VH valve or something else to filter
in the TC pipeline.

> If so, what Host objects would
> need to be added, and how would the Poker and Pinochle applications be
> bound to them?  And is there any explicit relationship between
> Listener and Host other than them being in the same Container?

By listener, do you mean the connector listener?

If so, the connector and host are completely separate entities.  You
would only use a connector to tell TC to respond on specific IP
addresses.  Thats as far as the relationship goes.  The Host filtering
the URL for VH is next in line.

Let me know if I didn't answer what you were looking for.

> 
> Thanks,
>     Aaron
> 
> On 1/16/06, Jeff Genender <jgenender@apache.org> wrote:
>>
>> David Jencks wrote:
>>
>>> To clarify, the tomcat and jetty interpretations of the multiple virtual
>>> host elements in an ejb web service plan are completely unrelated:
>>> -- jetty: the vh elements are actually used as virtual host names
>>> -- tomcat: the first vh element if present is used to find a tomcat host
>>> object, whose name has nothing to do with any aliases/virtual host names.
>> I don't agree here.  According to the Tomcat doc, the Host name is
>> "Network name of this virtual host, as registered in your Domain Name
>> Service server."  So it is a virtual host name.  Where I think where the
>> code can be expanded is searching the alias name for a match in case the
>> name is not the same as the VH.  This is probably a good thing to add.
>>
>> Jeff
>>

Mime
View raw message