> From: Jeffrey Janner [mailto:jeffrey.jan...@polydyne.com]
> Subject: RE: Tomcat 6.0 always uses default host in multi-host config
> 
> When you have a config like the OP, where each host
> is defined by name, not IP, in the server.xml, there
> is obviously some resolution of IP to name that has 
> to take place.

No, there isn't.  The HTTP host header is already a name, so it's a simple 
string match.  The only additional work is when useIPVHosts is true - the IP 
address has to be retrieved from the TCP/IP stack and converted to a string 
first.

> There is nothing that Tomcat has to rely on outside the 
> server.xml to properly route the traffic.

True regardless of the configuration.

> Anything that "magically" does something is a trick, even 
> if it's a specifically coded trick.

I still don't see why you think anything magic is going on; it all seems very 
straightforward to me.

> As you can see, there is nothing about how it
> determines the host<->IP mapping.

Because there isn't any.

> I'm not saying it isn't an advantage, but given the drawback 
> of having traffic route inappropriately if your name resolution
> is not perfect, is it that great?

Again, there's *no name resolution* going on - anywhere.  HTTP requests come in 
with a host header, and that's what is normally used to determine which <Host> 
to give the message to.  When you set useIPVHosts to true, you defeat this 
mechanism, as documented.

> 1) Set useIPVHosts to true in all <Connectors>.

I have yet to see a valid reason to do that.  The simplest, least overhead 
configuration is a single <Connector> for each port, and let the HTTP host 
header do the routing.  You can set up the defaultHost to be one that simply 
returns an error if the client fails to send in a valid HTTP host header.  You 
can also set aliases for expected synonyms of the <Host> name.

> 3) Otherwise it will make a call to the system resolver, 
> passing the IP address to lookup and expecting a hostname
> in return.

Nope, doesn't happen.

> Or really, should we do what we'd do in Apache and set up 
> the <Host> elements with name="ip address" instead of a 
> text-based name, and not really worry about the text-based
> name at all - eliminating the need for any <alias> entries.

No, because that eliminates the very common usage case of having multiple 
domains point to the same IP address; you want to be able to differentiate 
based on the URI of the request, not the IP address it happens to arrive on.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to