I'm running nginx
as reverse proxy on 3 different hosts. The DNS resolves production.example.com to all 3 hosts' IP addresses. Thus I have some sort of load balancing and fallback if one host is not available.
Every host is running several docker containers. Some of them are running on all three hosts, some only on two or even just one host.
Utilizing nginx
's proxy_pass
I forward all requests to the container's internal name (I'm using Rancher thus every container is accessable via container_name.stack_name via internal DNS).
Every now and then, a container is not available or does not respond and thus nginx
returns an error 502.
Is there any way to have and automatic fallback for this? Unfortunately nginx
ignores all other resolved addresses for an internal Docker container name and thus does not forward the request to a different address.