Make nginx ignore unresolvable upstream server host names during reload or boot up

shivramg94 nginx-forum at forum.nginx.org
Thu Mar 8 06:36:59 UTC 2018


Hi,

I have multiple upstream servers configured in an upstream block in my nginx
configuration. 

upstream example2 {
    server example2.service.example.com:8001;
    server example1.service.example.com:8002;
}

server {
   listen 80;
   server_name example2.com;
   location / {
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_pass http://example2/;
   }
}

When i try to reload Nginx and at that time if one of my upstream servers
(say example2.service.example.com) is not DNS resolvable, then the reload
fails with an error "host not found in upstream".

Is there any way we can ask nginx to ignore such unresolvable host names or
rather configure Nginx to resolve these upstream server host names at run
time instead of resolving it during the boot up or reload process?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278968,278968#msg-278968



More information about the nginx mailing list