> From: Caldarale, Charles R
> Subject: RE: Tomcat 6.0 always uses default host in multi-host config
> 
> > 1) If useIPVHosts=false (default), then the host header name
> > determines <Host> for processing, or default host of the Engine.
> > 2) If useIPVHosts=true, then IP address of request determines <Host>
> > for processing, providing the IP is provided as the host name, or
> > <Alias>. If not found, then default host of Engine applies.
> > 3) Nothing external to server.xml matters to Tomcat in resolving
> > <Host> for processing.
> >
> > Does that sound accurate?
> 
> I think so, but will have to verify by looking at current code.

I was mistaken about #3: there is a lookup done to convert the IP address of 
the socket the request arrived on to a name; this is done by the following code 
in org.apache.coyote.http11.Http11Processor (and equivalents for other 
connector types):

    if ((localName == null) && (socket != null)) {
        InetAddress inetAddr = socket.getLocalAddress();
        if (inetAddr != null) {
            localName = inetAddr.getHostName();
        }
    }

Since the JVM caches DNS entries, I would think this will cause only one 
external DNR request for the lifetime of Tomcat.  Note that this is done for 
the _request_, not the <Host>, and if the name is not resolvable, the symbolic 
form of the IP address is returned (so watch out for mixed IPv4/IPv6 networks). 
 The value of the <Host> name or <Alias> elements must match that returned by 
InetAddress.getHostName() to get a successful match.

 - 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