I've been looking for some time now, how to achieve that, but I can't seem to find similar solutions or synthesize one from my knowledge.
Here are the details about my setup: I have one gateway/router that has the uplink to the internet. "Behind" that are several different servers. Some of those have a public IP, others don't. Either way, all the services I wanted to expose are exposed by either unblocking the respective port on the target IP or DNATing the port through to one of the machines with no public IP. That whole setup works nicely (for the bigger part it's a netfilter-based ruleset in combination with a few routing table entries).
Now the problem: sometimes machines behind the router can be down (I can't afford extra redundancy at the moment). If that happens, I would like the user of a service - in particular HTTP - to have a "better" user experience than a network timeout and offer a "backup" server that would only display a short notice about the fact that the service behind the router is down at the moment. So if the router can't reach the service, it should re-route the traffic dynamically to the "backup".
Does anyone know of a solution to this problem or can suggest a way how to approach it? Suggestions for search terms are also welcome ...