I am starting to sell a service, from a secure site to clients. Some have access via fixed IPs from their offices, some have VPN (softEther) access. I also have redundancy and hot cut over. Currently these all have different IP addresses which I have set as subdomains. I want to be able to give my customer one link, e.g. TheirCompany.myService.com
If they go to https://TheirCompany.myService.com from their fixed IP address, it should use company000.myservice.com. If they are logged into their VPN, it should seamlessly go to company001.myservice.com. If server1 is down, use server2. (If none are accessible it should give some helpful login instructions.)
My current thinking is I need yet another public facing page TheirCompany.myService.com which will test with javascript all the options and redirect as appropriate. Am I missing something clever with Apache or Cloudflare that could do this work for me?