I have this nginx configuration entry.
http {
resolver 172.17.42.1 valid=600s;
resolver_timeout 60s;
In this configuration there 2 two different timeouts. The nginx documentation does not make it clear to me what is the difference between valid and resolver_timeout.
Can someone explain in detail?
resolve_timeout
sets how long NGINX will wait for answer from resolver (DNS).
valid
flag means how long NGINX will consider answer from resolver as valid and will not ask resolver for that period.
In your example, let's say NGINX want to resolve example.com
. It will ask resolver (172.17.42.1) and if resolver doesn't answer within 60 seconds NGINX will fail this request (and probably show you 500 error). Let's say resolver successfully answered, then NGINX will remember that answer for 10 minutes. If NGINX needs to resolve example.com
within that time, then it will use previous answer instead of asking resolver again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With