Prevent NGINX from rerouting to a backend that was previously down

I’m using NGINX’s ip_hash directive to ensure that client requests
end up at the same backend server. In the case of a backend server
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.
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
app when it detects that a previously down server is available, or
preferably prevent NGINX from exhibiting this behavior?

Posted at Nginx Forum:,239781,239781#msg-239781