NGINX timeout issue

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

Hi,

On Dec 3, 2013, at 1:45 AM, Shankar Dagadu B. [email protected]
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
(“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.

:slight_smile: