# Dns name for upstream

**URL:** <https://www.ruby-forum.com/t/dns-name-for-upstream/244249>\
**Category:** NGINX\
**Created:** [March 10, 2016, 11:55pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249 "2016-03-10T23:55:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [March 10, 2016, 11:55pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/1 "2016-03-10T23:55:48Z")

</div>

Hi,

I saw this example at [serverfault.com](http://serverfault.com):

server {  
…  
resolver 127.0.0.1;  
set $backend “[http://dynamic.example.com:80](http://dynamic.example.com:80)”;  
proxy\_pass $backend;  
…  
}

I have a few questions:

1. If the resolver DNS becomes unavailable (say connection timeout),  
what  
will nginx do? Will it keep using the old IPs or will it flush the DNS  
since TTL expires? If later, the proxy will stop working.
2. In the upstream block, I could define “keepalive #”, but with this  
example, how can I do that?
3. This page  
[Module ngx\_stream\_core\_module](http://nginx.org/en/docs/stream/ngx_stream_core_module.html#resolver)  
says  
“This directive is available as part of our commercial subscription.”.  
Is  
that still up to date? Can “resolver”, “resolver\_timeout” be used in  
free  
edition now?

Thanks!  
Frank

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 4:32am UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/2 "2016-03-11T04:32:42Z")

</div>

nginx1.94 ssl use TLS1.0.  
server {  
listen 443;  
server\_name [a.com](http://a.com);

```
    ssi on;
    ssi_silent_errors on;
    ssi_types text/shtml;

    ssl on;
 ssl_certificate

```

ssl\_certificate\_key  
ssl\_protocols TLSv1 TLSv1.1 TLSv1.2;  
ssl\_ciphers HIGH:!aNULL:!MD5;  
ssl\_prefer\_server\_ciphers on;  
…}  
but nginx1.6.2 ssl use TLS1.2

removed\_email\_address@domain.invalid

From: Frank L.  
Date: 2016-03-11 06:55  
To: nginx  
Subject: dns name for upstream  
Hi,

I saw this example at [serverfault.com](http://serverfault.com):

server {  
…  
resolver 127.0.0.1;  
set $backend “[http://dynamic.example.com:80](http://dynamic.example.com:80)”;  
proxy\_pass $backend;  
…  
}

I have a few questions:

1. If the resolver DNS becomes unavailable (say connection timeout),  
what will nginx do? Will it keep using the old IPs or will it flush the  
DNS since TTL expires? If later, the proxy will stop working.
2. In the upstream block, I could define “keepalive #”, but with this  
example, how can I do that?
3. This page  
[Module ngx\_stream\_core\_module](http://nginx.org/en/docs/stream/ngx_stream_core_module.html#resolver)  
says “This directive is available as part of our commercial  
subscription.”. Is that still up to date? Can “resolver”,  
“resolver\_timeout” be used in free edition now?

Thanks!  
Frank

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 10:48am UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/3 "2016-03-11T10:48:31Z")

</div>

On Thu, Mar 10, 2016 at 11:55 PM, Frank L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> will nginx do? Will it keep using the old IPs or will it flush the DNS  
> since TTL expires? If later, the proxy will stop working.

​I suppose you will get a 504 ‘Gateway Timeout’?  
​

> 1. In the upstream block, I could define “keepalive #”, but with this  
> example, how can I do that?

​The keepalive directive is only valid in the upstream block and there  
does  
not see​m to be any equivalent.  
You could use an upstream name in your variable to dynamically choose an  
upstream group in which everything is configured as you wish.

1. This page

> [Module ngx\_stream\_core\_module](http://nginx.org/en/docs/stream/ngx_stream_core_module.html#resolver) says  
> “This directive is available as part of our commercial subscription.”. Is  
> that still up to date? Can “resolver”, “resolver\_timeout” be used in free  
> edition now?

## ​nginx Inc. seems to be very conservative about keeping the incentives to their product as part of their business model. No movement on that side since the dawn of times.

_B. R._

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 12:45pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/4 "2016-03-11T12:45:21Z")

</div>

On Thursday 10 March 2016 14:55:06 Frank L. wrote:

> }  
> that still up to date? Can “resolver”, “resolver\_timeout” be used in free  
> edition now?

It’s unclear about what module you are asking. Note that the “set” and  
“keepalive” directives are part of the “http” modules, while in 3-rd  
question you’re asking about the “resolver” directive in the “stream”  
module.

There are also “resolver” and “resolver\_timeout” directives in the  
“http” module, and they are available in free edition:

> **[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.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 10:58am UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/5 "2016-03-11T10:58:27Z")

</div>

On 3/11/16 12:47 PM, B.R. wrote:  
[…]

> ```
> 3) This
> page http://nginx.org/en/docs/stream/ngx_stream_core_module.html#resolver
> says "This directive is available as part of our commercial
> subscription.". Is that still up to date? Can "resolver",
> "resolver_timeout" be used in free edition now?
> 
> ```
> 
> ​ nginx Inc. seems to be very conservative about keeping the  
> incentives to their product as part of their business model. No  
> movement on that side since the dawn of times.

Can you elaborate your point please?

–  
Maxim K.

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 2:10pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/6 "2016-03-11T14:10:38Z")

</div>

Hello!

On Fri, Mar 11, 2016 at 11:32:13AM +0800, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> ssl_certificate
> 
> ```
> 
> ssl\_certificate\_key  
> ssl\_protocols TLSv1 TLSv1.1 TLSv1.2;  
> ssl\_ciphers HIGH:!aNULL:!MD5;  
> ssl\_prefer\_server\_ciphers on;  
> …}  
> but nginx1.6.2 ssl use TLS1.2

Please do not hijack unrelated threads. Thank you.

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 16, 2016, 5:34pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/7 "2016-03-16T17:34:55Z")

</div>

On Friday 11 March 2016 07:01:49 Frank L. wrote:

> Hi Valentin,  
> Thanks for clearing up . I was looking at the wrong module.  
> Do you have any comments to the other two questions?

1. That will result in “502 Bad Gateway” response, and corresponding  
message will be written to error\_log.

2. There’s the “resolve” parameter of the “server” directive in  
upstream,  
but it’s available in commercial version only.

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 16, 2016, 5:41pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/8 "2016-03-16T17:41:56Z")

</div>

You can try to use this module to resolve the DNS 😉

> **[GitHub - GUI/nginx-upstream-dynamic-servers: An nginx module to resolve...](https://github.com/GUI/nginx-upstream-dynamic-servers)**
>
> An nginx module to resolve domain names inside upstreams and keep them up to date. - GitHub - GUI/nginx-upstream-dynamic-servers: An nginx module to resolve domain names inside upstreams and keep t...

On Wed, Mar 16, 2016 at 1:34 PM, Valentin V. Bartenev [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![fjlj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e79b87/32.png) [@fjlj](https://www.ruby-forum.com/u/fjlj)\
**Post date:** [March 11, 2016, 4:02pm UTC](https://www.ruby-forum.com/t/dns-name-for-upstream/244249/9 "2016-03-11T16:02:13Z")

</div>

Hi Valentin,  
Thanks for clearing up . I was looking at the wrong module.  
Do you have any comments to the other two questions?  
Frank
