I have a domain name myapi.example.com
with CNAME
pointing to my load balancer, in my load balancer I register 2 ec2 servers
Each ec2 servers have nginx configure
listen 80;
listen [::]:80;
server_name myapi.example.com;
proxy_pass http://127.0.0.1:4000;
I see that the loadbalancer is hitting my server in a round robin fashion, but if one of my server is down, the loadbalancer still hits it resulting in 502
Is there a way for the loadbalancer to detect that the server is down and reroute?