I have an NGINX TCP load balancer with the following configuration:
user myusername;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
events {
worker_connections 1024;
}
stream {
upstream api_backend_http {
server myserver1.mydomain.com:80;
server myserver2.mydomain.com:80;
}
upstream api_backend_https {
server myserver1.mydomain.com:443;
server myserver2.mydomain.com:443;
}
server {
listen 80;
proxy_pass api_backend_http;
proxy_buffer_size 16k;
proxy_connect_timeout 1s;
}
server {
listen 443;
proxy_pass api_backend_https;
proxy_buffer_size 16k;
proxy_connect_timeout 1s;
}
}
The DNS TTL of myserver1.mydomain.com is set to 30 seconds. 45 Minutes after changing this, NGINX is still sending traffic to the old IP address.
This shouldn't happen - ideally it should respect the TTL of the upstream server DNS name. But it doesn't seem to be doing that. Does anyone know what the actual TTL is, and how to change it?
Side note, this feels like a bug in NGINX.