We're using an AWS elastic loadbalancer to balance upstream traffic. It is useful for dynamically adding / removing servers in a central location and supports some nice features (e.g. connection draining, auto scaling, etc...).
The problem we're having is that nginx only resolves the IP of our AWS loadbalancer at startup and then caches the IP forever (until nginx reboot). Since the AWS loadbalancer IP can change anytime this is obviously a big problem.
I found
this issue / feature request on the ngx_lua_upstream module which I think could help solve our problem. However, it isn't currently implemented.
Does anyone know of any other method to invalidate an upstream DNS cache / force nginx to honor DNS TTL responses?
I'm aware of the upstream "resolve" option in nginx+ but I'd rather not pay nginx+ license fees just for this option. Also, I'd much rather use the exact nginx version that has been thoroughly tested by agentzh as part of an OpenResty release.