nginx: [emerg] host not found in resolver "ipv6=off"

1,974 views
Skip to first unread message

Warren Strange

unread,
May 13, 2016, 4:45:23 PM5/13/16
to openresty-en

I'm getting a really baffling error on nginx startup with openresty 1.9.7.4 

This *used* to work, so I'm really scratching my head trying to figure out what I might have changed. 

This is running in a Docker container.  I have stripped down nginx.conf to a bare bones startup.

I have module configured

resolver 8.8.8.8 ipv6=off;


I get this error:

nginx: [emerg] host not found in resolver "ipv6=off"

If I comment out the resolver line, nginx comes up. 

(I need the resolver for the OpenID connect module to work)

Thanks



Warren Strange

unread,
May 13, 2016, 5:03:56 PM5/13/16
to openresty-en

Just to add..

I tried building with and without the --with-ipv6 option

Same error 

Warren Strange

unread,
May 13, 2016, 5:24:36 PM5/13/16
to openresty-en


OK - this is embarrassing, but I had a extra space on the resolver line:

resolver 8.8.8.8 ipv6 = off;
(note extra spaces.....)

Sigh....

RJoshi

unread,
May 19, 2016, 4:52:19 PM5/19/16
to openresty-en
If I use more than one resolver IP and use ipv6=off, it is treating "ipv6=off" as host and giving invalid host error.

Warren Strange

unread,
May 19, 2016, 5:42:08 PM5/19/16
to openresty-en

The parser seems rather fragile (sensitive to white space, etc.), so I can only suggest triple checking the syntax.

RJoshi

unread,
May 20, 2016, 9:58:15 AM5/20/16
to openresty-en
I found the issue.  It checks for "ipv6=" token in #if (NGX_HAVE_INET6) block.  so if NGX_HAVE_INET6 is not enabled, it treats it as a host instead of ignoring it.

eg:
#if (NGX_HAVE_INET6)
        if (ngx_strncmp(names[i].data, "ipv6=", 5) == 0) {

            if (ngx_strcmp(&names[i].data[5], "on") == 0) {
                r->ipv6 = 1;

            } else if (ngx_strcmp(&names[i].data[5], "off") == 0) {
                r->ipv6 = 0;

            } else {
                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                                   "invalid parameter: %V", &names[i]);
                return NULL;
            }

            continue;
        }
#endif

should have been:


        if (ngx_strncmp(names[i].data, "ipv6=", 5) == 0) {
#if (NGX_HAVE_INET6)
            if (ngx_strcmp(&names[i].data[5], "on") == 0) {
                r->ipv6 = 1;

            } else if (ngx_strcmp(&names[i].data[5], "off") == 0) {
                r->ipv6 = 0;

            } else {
                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                                   "invalid parameter: %V", &names[i]);
                return NULL;
            }
#endif
            continue;
        }

Reply all
Reply to author
Forward
0 new messages