# NGINX timeout issue

**URL:** <https://www.ruby-forum.com/t/nginx-timeout-issue/237840>\
**Category:** NGINX\
**Created:** [December 3, 2013, 10:46am UTC](https://www.ruby-forum.com/t/nginx-timeout-issue/237840 "2013-12-03T10:46:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [December 3, 2013, 10:46am UTC](https://www.ruby-forum.com/t/nginx-timeout-issue/237840/1 "2013-12-03T10:46:57Z")

</div>

Hi all,  
We are using nginx as proxy server in all our production deployment. The  
nginx server proxy the http request to Amazon ELB (elastic load  
balancer) using upstream module. Currently we are seeing timeout issues  
in NGINX because NGINX caches the IP address on start. Now when there is  
change in IP address of ELB, NGINX doesn’t updates it’s IP and still  
point to old IP. We went through many post on internet and tried setting  
resolver to AWS DNS server, resolver timeout to 20s, valids to 30 sec.  
defining variable instead of direct name in proxy pass, request URL in  
proxy pass but nothing has worked for us. NGINX is not honoring the  
resolver and corresponding TTL settings.  
Some of the blogs also says that they have tried similar things and  
nothing works for them. IT looks to me like this is bug in NGINX and  
will be resolved only by changing the source.  
Has anybody found solution to this problem? If yes, please let us know  
your configurations.  
Only solution I have right now is write some script and restart the  
server when timeout occurs. But this is not ideal solution.  
I am seriously thinking of moving to Apache Http server if this problem  
doesn’t get resolved.

Regards,  
Shankar

---

<div class="post-metadata">

**Author:** ![Shankar\_Dagadu\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@Shankar\_Dagadu\_B](https://www.ruby-forum.com/u/Shankar_Dagadu_B)\
**Post date:** [December 3, 2013, 11:10am UTC](https://www.ruby-forum.com/t/nginx-timeout-issue/237840/2 "2013-12-03T11:10:20Z")

</div>

Hi,

On Dec 3, 2013, at 1:45 AM, Shankar Dagadu B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi all,
> 
> We are using nginx as proxy server in all our production deployment. The nginx  
> server proxy the http request to Amazon ELB (elastic load balancer) using upstream  
> module. Currently we are seeing timeout issues in NGINX because NGINX caches the  
> IP address on start. Now when there is change in IP address of ELB, NGINX doesnt  
> updates its IP and still point to old IP. We went through many post on internet  
> and tried setting resolver to AWS DNS server, resolver timeout to 20s, valids to  
> 30 sec. defining variable instead of direct name in proxy pass, request URL in  
> proxy pass but nothing has worked for us. NGINX is not honoring the resolver and  
> corresponding TTL settings.
> 
> Some of the blogs also says that they have tried similar things and nothing  
> works for them. IT looks to me like this is bug in NGINX and will be resolved only  
> by changing the source.
> 
> Has anybody found solution to this problem? If yes, please let us know your  
> configurations.
> 
> Only solution I have right now is write some script and restart the server when  
> timeout occurs. But this is not ideal solution.

Can you paste the relevant part of your nginx configuration here?  
If that’s about re-resolving server names in an upstream server group,  
then yes - there’s no  
such functionality in nginx at this time.

Still, if you’re using proxy\_pass to a “single server” instead of an  
upstream server group,  
re-resolving works. That might be a workaround since you appear to proxy  
to a single  
entry-point which is terminated on ELB?

Please check,  
[http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html#proxy\_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass)  
(“If a domain name resolves to several addresses, all of them will be  
used in a round-robin fashion.”)

Also,  
“A server name, its port and the passed URI can also be specified using  
variables:  
proxy\_pass http://$host$uri;  
or even like this:  
proxy\_pass $request;  
In this case, the server name is searched among the described server  
groups, and, if not found, is determined using aresolver.”

Hope this helps

> I am seriously thinking of moving to Apache Http server if this problem doesnt  
> get resolved.

🙂
