On 8/18/07, Jerome Louvel <[EMAIL PROTECTED]> wrote:
>
> Alex,
>
> > > The "serverAddress" property indeed does comparisons based on the
> > > numerical IP address. There are some convenience static methods on
> > > VirtualHost:
> > >  - getLocalHostAddress()
> > >  - getIpAddress(String domain)
> >
> > This seems a bit inconsistent that you can use hostname when
> > adding a server:
> >
> >    getServers().add(Protocol.HTTPS,"localhost",8080);
> >
> > but you have to use a numeric ip addresses with
> > setServerAddress on VirtualHost:
> >
> >    vhost.setServerAddress("127.0.0.1");
>
> The problem is that the mapping between domain name and IP address isn't
> symetric. One IP can be mapped to several domain names. However, a domain
> name maps to one and only one IP.
>
> Hence, using a domain name when adding a server is just a shortcut for
> adding the equivalent IP address.

In the end, when you add the server the domain name resolves to a single
IP address that is the bind address for the server.  My only suggestion is that
if I can use a name to set the bind address I should be able to use the same
name to restrict a VirtualHost instance to that same address.

I think the fact that a IP address can have multiple names isn't important
here.  When you use a domain name to specify a bind address, you're going
to get *one* IP address that must map to a local address.  If you have a server
farm, that IP would be the address of the load balancer and not the local
machine and so that's never going to happen.

In my case, I have a hostname that is load balanced but I have a specific
bind address I want to use on the local machine.  I setup a DNS name for
that bind address so that it can be managed by name.  When I add the server,
I use that DNS name as the server's bind address.  Internally, that address gets
resolved to a numeric IP address and that is what you see in the logs.

I don't see the issue with allowing VirtualHost.setServerAddress() to do the
same a resolve a domain name to a numeric IP address.  If you give it the
wrong domain name that is the same error as giving it the wrong IP address.


--Alex Milowski

Reply via email to