# DNS TTLs being ignored

**URL:** <https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278>\
**Category:** NGINX\
**Created:** [October 28, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278 "2011-10-28T16:31:31Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [October 28, 2011, 4:31pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/1 "2011-10-28T16:31:31Z")

</div>

I have recently come across several related issues which I have tracked  
down  
to nginx and the way it handles DNS.  
I run nginx as a proxy for several back end services. It works really  
well,  
except for 1 thing.  
My proxy\_pass refers to an upstream which points to a DNS entry.  
That DNS entry is a CNAME with a TTL of 60 seconds.  
Nginx doesn’t appear to be honoring that TTL. This has happened twice  
now.  
My upstream DNS information has changed, pointing to a new IP address.  
Instead of recovering withing 1 minute (which would happen if TTLs were  
being honored), I have had to restart nginx.  
When I searched for it, I found that nginx doesn’t appear to honor TTLs,  
at  
all ([Does Nginx honor DNS TTLs for proxy upstreams? - NGINX - Ruby-Forum](http://www.ruby-forum.com/topic/2657341)).

What I’m hoping to find out, is why?  
Why does nginx cache DNS entries, instead of referring to the operating  
system? The OS has DNS handling built in. It respects TTLs, and it works  
perfectly. Nginx, on the other hand, is effectively broken as a load  
balancer, since upstreams might change IP addresses at any time (which  
is  
why we’re using DNS names, instead of IP addresses.

Thanks,  
Noah

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [October 28, 2011, 4:51pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/2 "2011-10-28T16:51:22Z")

</div>

Noah,

Right, thanks for your observation. It really took a while, but we’re  
actually about to fix this one shortly.

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [November 3, 2011, 10:46am UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/3 "2011-11-03T10:46:14Z")

</div>

Thanks for the reply Andrew. Do you have any idea when it’s likely to be  
generally available? This is a pretty big nuisance for us, and I’d like  
to be able to figure out if I need to look at using a new reverse proxy,  
at least for the time being.

–Noah

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [November 3, 2011, 10:51am UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/4 "2011-11-03T10:51:35Z")

</div>

Noah,

This fix/improvement be introduced in 1.1.8 which will come out around  
Nov 14.

Hope this helps

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [November 15, 2011, 10:50am UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/5 "2011-11-15T10:50:41Z")

</div>

On Nov 3, 2011, at 1:50 PM, Andrew A. wrote:

> Noah,
> 
> This fix/improvement be introduced in 1.1.8 which will come out around Nov 14.

Apologies, it didn’t get in either 1.1.8 (yesterday) or 1.1.10 (today).  
It’s almost ready and would hopefully get into the next dev and stable  
releases in a couple of weeks.

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [November 16, 2011, 3:01pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/6 "2011-11-16T15:01:06Z")

</div>

On Nov 15, 2011, at 1:50 PM, Andrew A. wrote:

> On Nov 3, 2011, at 1:50 PM, Andrew A. wrote:
> 
> > Noah,
> > 
> > This fix/improvement be introduced in 1.1.8 which will come out around Nov 14.
> 
> Apologies, it didn’t get in either 1.1.8 (yesterday) or 1.1.10 (today). It’s  
> almost ready and would hopefully get into the next dev and stable releases in a  
> couple of weeks.

Jfyi, it went committed today

> **[\[nginx\] svn commit: r4296 - trunk/src/core](http://mailman.nginx.org/pipermail/nginx-devel/2011-November/001466.html)**

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver)**
>
> This directive appeared in version 1.11.8.

and will be included in 1.1.9.

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [February 6, 2012, 4:13pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/7 "2012-02-06T16:13:01Z")

</div>

Hello!

On Mon, Feb 06, 2012 at 03:03:14PM +0000, Jonathan M. wrote:

> > Jfyi, it went committed today
> > 
> > [[nginx] svn commit: r4296 - trunk/src/core](http://mailman.nginx.org/pipermail/nginx-devel/2011-November/001466.html)  
> > [Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver)
> > 
> > and will be included in 1.1.9.
> 
> You mentioned it’d be in stable at some point.  
> I can’t find it in any subsequent 1.0.x announcement - could you  
> clarify the status of this feature in stable please?

It’s not in 1.0.x, and probably won’t be. The 1.1.x branch is  
expected to become stable in near future.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [November 18, 2011, 3:27pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/8 "2011-11-18T15:27:44Z")

</div>

That’s great news. Thank you very much. I’ll be sure to get hold of it  
as soon as 1.1.9 is released.

–Noah

---

<div class="post-metadata">

**Author:** ![Noah\_Cantor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/87869e/32.png) [@Noah\_Cantor](https://www.ruby-forum.com/u/Noah_Cantor)\
**Post date:** [February 6, 2012, 4:03pm UTC](https://www.ruby-forum.com/t/dns-ttls-being-ignored/213278/9 "2012-02-06T16:03:41Z")

</div>

On 16 November 2011 14:00, Andrew A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Jfyi, it went committed today
> 
> [[nginx] svn commit: r4296 - trunk/src/core](http://mailman.nginx.org/pipermail/nginx-devel/2011-November/001466.html)  
> [Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver)
> 
> and will be included in 1.1.9.

You mentioned it’d be in stable at some point.  
I can’t find it in any subsequent 1.0.x announcement - could you  
clarify the status of this feature in stable please?

## Many thanks, Jonathan

Jonathan M.  
London, UK

> **[Jonathan Matthews :: Words Typed, Great Rates For Cash](https://www.jpluscplusm.com)**
