Resolve hostname to IPv6 address in listen directive

Piotr Sikora piotr.sikora at
Fri Aug 27 11:43:13 MSD 2010

Hi Matthias,

>  1. Remove ipv6only and make IPV6_V6ONLY default as specified in
>     RFC 4038.

"ipv6only" should be deprecated (ignored) and not removed.

>  2. Use getaddrinfo() instead of gethostbyname().

Agreed, but it should also fall-back to gethostbyname2() and finally to 

(Are there any systems that have gethostbyname2() but don't have 

>  3. Listen on multiple IPv4 or IPv6 addresses if a hostname was
>     given in a listen directive.


>  4. Add the options “ipv4” and “ipv6” to the listen directive
>     to set ai_family to AF_INET or AF_INET6 in struct addrinfo. This
>     could be useful if you want to serve a different site depending
>     on the address family the request came from or to simple disable
>     IPv6 or IPv4 even if the hostname has an associated address.


> getaddrinfo() can resolve services and numeric addresses itself, so I
> don't see need for the square bracket notation as in RFC 3986, a simple
> space would be enough and would make parsing much easier:
>   listen 2001:db8::1 www;

Yeah, I don't see the need for square brackets.

> What do you think about this?

Do you have patch for this? :)

Best regards,
Piotr Sikora < piotr.sikora at >

More information about the nginx-devel mailing list