configuration test ignores custom resolver

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

configuration test ignores custom resolver

Anton Demenev
Hi everyone!

Unfortunately, I can't find information about how Nginx tests
configuration files.

In my case I have a two internal DNS zones, .develop and .test.

On global http section I added my resolver:

...

http {
     resolver 192.168.140.249 valid=300s;
     resolver_timeout 1s;

...

And I use proxy_pass directive with DNS name likeproxy_pass
http://front-dev.develop;

I expect, that Nginx start to use resolver for upstream name resolving
on test config stage.

But everything go wrong...

On strace output I see, that on start Nginx uses system resolver,
ignoring custom resolver from config.

Can anyone help with this? What I do wrong?

Regards,

Anton.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: configuration test ignores custom resolver

Francis Daly
On Mon, Sep 07, 2020 at 12:02:58PM +0700, Anton Demenev wrote:

Hi there,

> Unfortunately, I can't find information about how Nginx tests configuration
> files.

As far as I know, it's pretty much "do everything apart from actually
listen on ports or write to files".

> In my case I have a two internal DNS zones, .develop and .test.
>
> On global http section I added my resolver:
>
> ...
>
> http {
>     resolver 192.168.140.249 valid=300s;
>     resolver_timeout 1s;
>
> ...
>
> And I use proxy_pass directive with DNS name likeproxy_pass
> http://front-dev.develop;
>
> I expect, that Nginx start to use resolver for upstream name resolving on
> test config stage.

No.

nginx uses the system resolver at startup, to resolve whatever "obviously
static" hostnames are in the config.

nginx uses the "resolver"-directive resolver at runtime, to resolve
whatever other hostnames apply then.

http://nginx.org/r/proxy_pass has some information about when a resolver
is used.

> But everything go wrong...
>
> On strace output I see, that on start Nginx uses system resolver, ignoring
> custom resolver from config.
>
> Can anyone help with this? What I do wrong?

https://www.nginx.com/blog/dns-service-discovery-nginx-plus/ shows some
more information; the first half of that document is valid for nginx
(non-plus).

Probably the simplest nginx-way is to use a variable in your proxy_pass
directive, so that the hostname is not "obviously static" at startup,
and so that the system resolver will not be used then.

Good luck with it,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx