Resolve hostname to IPv6 address in listen directive

Maxim Dounin mdounin at mdounin.ru
Wed Aug 25 23:00:08 MSD 2010


Hello!

On Wed, Aug 25, 2010 at 08:01:17PM +0200, Piotr Sikora wrote:

> Hi,
> 
> >Note well: listen with hostname always uses *one* address returned
> >by hostname lookup, the first one returned by gethostbyname().  It
> >doesn't make sense to attempt to use it with hostname which
> >resolves to multiple addresses.
> 
> But is that correct behavior? Shouldn't nginx listen on all of them?

I've just outlined how it works.  If you feel brave enough - you 
may try to produce patch to which changes "listen" to use all 
addresses hostname resolves to.  But I suspect it's size will be 
bigger than the problem deserves.

> >I believe correct solution would be to make
> >
> >   listen example.com;
> >
> >to use ipv6 address if no ipv4 addresses were found.
> 
> Why not on both?

Just to preserve "how it works".

Maxim Dounin



More information about the nginx-devel mailing list