0

I've recently encountered an issue where due to the DNS cache within Nginx a service was negatively impacted because we use upstream settings within the associated Nginx configuration. I've reviewed the following issue already as well as searching for a solution, none of them use upstream: https://stackoverflow.com/questions/26956979/error-with-ip-and-nginx-as-reverse-proxy . Due to the fact we use an AWS ELB we identify two of the same server values that sit inside the upstream. The relevant section looks like this:

upstream my_server {
  server blah.domain.com:443;
  server blah.domain.com:443;
}

server {

  listen 1024;
  access_log /var/log/nginx/my-access-log.log;
  error_log /var/log/nginx/my-error-log.log;

  keepalive_timeout 5;
  client_max_body_size 40M;

  location /blah {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host blah.domain.com;
    proxy_redirect off;
    proxy_pass https://my_server;
}

So I know that I could use a resolver and create an http section which the server section sits inside of, however I can't set a variable that will then use the Nginx load balancer functionality. I can't set a variable inside of upstream as it is not supported (which would force the DNS cache to refresh as noted here: http://forum.nginx.org/read.php?2,215830,215832#msg-215832).

So my question is how do I work around this? How do I maintain the functionality that upstream provides for load balancing while also ensuring the DNS cache is flushed without restarting the service in the community version of Nginx?

2

The functionality described is provided in NGINX Plus, the complete application delivery platform that provides additional features.

You can read about the "On-the-Fly Reconfiguration" functionality provided by NGINX Plus and see the documentation under the "Dynamically Configurable Group" section for more information about this specific feature.

(Disclaimer: I am affiliated with NGINX, Inc - the company that develops both versions of NGINX).

  • Hey Patrick, I probably should have specific this in my question original (which I have now edited for clarity) but is there any way to do this with the community version? The commercial version isn't in the cards currently. Thank you for your answer regardless. – Forrest Sep 10 '15 at 5:55
  • Our site rules require you to disclose your affiliation when promoting a commercial product. – womble Sep 10 '15 at 5:56
  • @womble Thanks for the info, but I didn't think it applies to this question after reading meta.stackexchange.com/questions/204665/…. Please clarify? – Patrick Nommensen Sep 10 '15 at 6:03
  • @Forrest Dynamically configurable upstream groups are only available in the specified version of NGINX. There may be third party solutions (I'm not familiar with any). – Patrick Nommensen Sep 10 '15 at 6:10
  • 1
    @PatrickNommensen, please edit your answer to clarify your affiliation with the commercial product you are promoting. – womble Sep 10 '15 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.