Prevent NGINX from rerouting to a backend that was previously down

I’m using NGINX’s ip_hash directive to ensure that client requests
always
end up at the same backend server. In the case of a backend server
outage,
NGINX will reroute to the available server, and since I can listen for a
disconnection event on my client application, I can have my client-side
application react accordingly. However, when the previously down server
comes back up, NGINX will route requests back to the original server.
This
breaks my application, as I have no way of knowing that this happens
from my
client-side application.

So is there a way for NGINX to send a notification event to my
client-side
app when it detects that a previously down server is available, or
preferably prevent NGINX from exhibiting this behavior?

Posted at Nginx Forum: