Forum: NGINX Using Domain Names in proxy_pass directive

2974d09ac2541e892966b762aad84943?d=identicon&s=25 Shobhit Mishra (Guest)
on 2014-05-23 13:40
(Received via mailing list)
Hi

I am using nginx as reverse proxy with FQDN for the backend server .

My configuration for the location block looks like this :-

location / {

  set $ustreamsbc  sbc.example.com ;
  proxy_pass  HTTPS://$ustreamsbc   ;

                proxy_next_upstream error timeout invalid_header
http_500
http_502 http_503 http_504;

                proxy_connect_timeout 10s ;
                include /usr/local/nginx/conf/proxy.conf ;



                proxy_redirect     off;
      }

I have a resolver in place for this FQDN  and its running fine.


My doubt is that if I change the mapped IP for this FQDN in the DNS
server ,
would nginx re-resolve the FQDN to the new IP for all the future
requests.

Also does nginx honor TTL  for all the FQDN stored in variables as shown
above ??

Thanks and Regards

Shobhit Mishra

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250307,250307#msg-250307
2154be8b4430488454f0a067e09863b9?d=identicon&s=25 Ruslan Ermilov (Guest)
on 2014-05-23 14:21
(Received via mailing list)
On Fri, May 23, 2014 at 07:39:36AM -0400, Shobhit Mishra wrote:
>
>
>
> Shobhit Mishra

nginx will re-resolve names as configured by the
http://nginx.org/r/resolver directive.  By default,
the TTL of the response is honored but it can be
overridden.

(Whether the queried server has an up-to-date info
is another question.)
2974d09ac2541e892966b762aad84943?d=identicon&s=25 Shobhit Mishra (Guest)
on 2014-05-23 14:41
(Received via mailing list)
Thanks Ruslan  for the reply ..

I have another query regarding this ..

I am  planning to use more than one backend servers for supporting Load
balancing.

I would be using an upstream block for the same.

My default configuration is as below :

upstream us1
{
server sbc.example1.com:443 ;
server sbc.example2.com:443 ;

}

and the location block is

location / {


  proxy_pass  HTTPS://us1   ;

                proxy_next_upstream error timeout invalid_header
http_500
http_502 http_503 http_504;

                proxy_connect_timeout 10s ;
                include /usr/local/nginx/conf/proxy.conf ;



                proxy_redirect     off;
      }



Does nginx honor TTL for the FQDN in the upstream block as well ??

As per my understanding nginx resolves FQDN in upstream blocks only
during
configuration parsing ..

Please suggest on this.

Thanks

Shobhit Mishra

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250307,250311#msg-250311
40b4c848b8fcd63b0cb60b9d170c3a77?d=identicon&s=25 Valentin V. Bartenev (Guest)
on 2014-05-23 17:04
(Received via mailing list)
On Friday 23 May 2014 08:41:09 Shobhit Mishra wrote:
[..]
> Does nginx honor TTL for the FQDN in the upstream block as well ??
>
> As per my understanding nginx resolves FQDN in upstream blocks only during
> configuration parsing ..
>
> Please suggest on this.

Look at the "resolve" parameter:
http://nginx.org/en/docs/http/ngx_http_upstream_mo...

  wbr, Valentin V. Bartenev
2974d09ac2541e892966b762aad84943?d=identicon&s=25 Shobhit Mishra (Guest)
on 2014-05-25 09:29
(Received via mailing list)
This solution would really help .

Thanks a lot for the info .. :)

Regards

Shobhit Mishra

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250307,250341#msg-250341
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.