> -----Original Message-----
> From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
> Sent: Tuesday, May 25, 2010 4:47 PM
> To: Tomcat Users List
> Subject: RE: Tomcat 6.0 always uses default host in multi-host config
> 
> > From: Jeffrey Janner [mailto:jeffrey.jan...@polydyne.com]
> > Subject: RE: Tomcat 6.0 always uses default host in multi-host
config
> >
> > OK, to answer my own question on this, useIPVHosts is
> > essentially a way to save some configuration writing
> > at the expense of doing a reverse-DNS lookup on every
> > access, correct?
> 
> No.  Setting useIPVHosts to true says to use the local IP address
> rather than the HTTP "host" header value for determining which <Host>
> to give the request to.
> 

Yes, but how does it determine the host to route to?  That was the
initial question.  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. Now, whether it does
that at each connection, or at startup & cached, I don't know.  I'm sure
a search of source would provide that answer.  I was only making an
assumption about the process, but it still seems to me to be a little
extra work involved for each connection to route it to the correct host.

> > You can do it my way below, and have everything clearly
> > spelled out
> 
> It's only clearly spelled out to you, since you implemented.  Looks
> like a lot more work and overhead to me, and certainly no simpler.
> 
> > or you can use this config trick and let TC manage it for you.
> 
> It's clearly not a trick.

Obviously, I meant clearer in terms of being able to understand what's
going on without detailed understanding of the Tomcat source.  It is
more work to setup and not a simple implementation, but it is specific
in the server.xml how traffic will route.  There is nothing that Tomcat
has to rely on outside the server.xml to properly route the traffic.
 
Anything that "magically" does something is a trick, even if it's a
specifically coded trick.  The documentation I've seen essentially says,
set this to true and tomcat will figure it out.  I used "trick" in this
manner, because I haven't found any specific documentation about how
this feature is expected to function, i.e. how to set it up "properly".
Got a reference?

Obviously, a real config "trick" is one where a certain combination of
parameters produces beneficial effects but not ones specifically planned
for (MS-based stuff is full of those). The term was misapplied in this
case. 

> 
> > But in a config setting useIPVHost="true" will only route
> > it to the correct host if the IP resolves to the host name
> > or alias
> 
> Which is exactly what the useIPVHosts setting is documented to do.

Where?  This is the only official documentation I have found on the
feature: "Set this attribute to true to cause Tomcat to use the IP
address that the request was received on to determine the Host to send
the request to. The default value is false."
(http://tomcat.apache.org/tomcat-5.5-doc/config/http.html)  That was my
original question.  As you can see, there is nothing about how it
determines the host<->IP mapping.

In my researching the feature, I found 3 to 4 posts about folks having
problems with this feature similar to the OP's over the past few years.
Almost all were resolved with either an <alias> entry or setting an
entry in the hosts file.  I'm guessing a lot of folks don't set up
reverse-DNS, and thus the problem.

> 
> > Aside from probably only needing to configure one port 80
> > connector, and probably allocating fewer resources as a
> > result, is there any other advantage to the parameter?
> 
> That seems to be a significant advantage to me.
> 
> - Chuck

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?  Are there other significant run-time advantages to this
feature, or disadvantages or drawbacks to my setup?

I'm not really advocating my set up as "the way", as I can see this as a
viable option, and one I might want to switch to if I understood it
better.  I have seen my config as a suggestion from others on this list
in the last few weeks.

OK, all the above aside, is my understanding of the feature essentially
correct?  To reitterate:

1) Set useIPVHosts to true in all <Connectors>.
2) When a connection is made Tomcat will look for a configured <Host>
with that IP address as name or alias, and execute in that <Host>.
3) Otherwise it will make a call to the system resolver, passing the IP
address to lookup and expecting a hostname in return.
4) Check returned hostname against server.xml <Hosts> and execute there
if found.
5) If returned hostname is "null" or not found in server.xml, then
execute in Engine's defaulthost.

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.

*******************************  NOTICE  *********************************
This message is intended for the use of the individual or entity to which 
it is addressed and may contain information that is privileged, 
confidential, and exempt from disclosure under applicable law.  If the 
reader of this message is not the intended recipient or the employee or 
agent responsible for delivering this message to the intended recipient, 
you are hereby notified that any dissemination, distribution, or copying 
of this communication is strictly prohibited.  If you have received this 
communication in error, please notify us immediately by reply or by 
telephone (call us collect at 512-343-9100) and immediately delete this 
message and all its attachments.


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

Reply via email to