Fallback HTTP redirect
Is there a way to provide a fallback url when redirecting HTTP redirects? What I am trying to achieve is that when I click on the original url, I would respond with an HTTP redirect (300, 307?) Specifying the new browser url and the fallback url in case new url disconnect?
I've also considered doing this client side, but it's just not very efficient (in terms of speed, customer support). What I would do is probably have a tiny 1x1px image on each server, try uploading it and then check with javascript which server is located and redirected there.
Any other ideas? Thanks to
a source to share
I think this can only be done via JavaScript. You can run a quick server test before sending a redirect, but this will not be reliable - especially if the servers are in the same server farm.
The safest thing will undoubtedly be JavaScript that makes a quick Ajax request (HEAD only) to the server and redirects to success. If that fails, try the next server ... and so on.
Is it really necessary? If there are so many outages on the target server that you need to respond to them programmatically, it might be worth looking at moving the server (or doing whatever is necessary to fix the outages).
a source to share