We have an Angular/Ionic app installed on iPhone and Android. The app calls an API on our IIS web server. When the server is up, everything works well.
However, while we are deploying a new version of the API website, we would like our app to show a maintenance page. Currently, during the deployment, we create an app_offline.htm file in the API site's root folder, which is the usual way of taking a website offline and showing a maintenance page in IIS.
Unfortunately, this means the CORS preflight request from our Ionic app also returns a 503 http error code; I guess that IIS takes the whole site down. We are unable to handle this 503 error in the Angular/Ionic app on the phone, since the preflight request is triggered by the browser. We add custom headers to each request, which cannot be avoided. The net result is that the maintenance page is not displayed when the API site is down.
Is there a way to show a maintenance page in our Ionic/Angular app while the API site is being deployed? Perhaps by configuring IIS to allow preflight requests even when app_offline.htm is in place, somehow handling the 503 on the Ionic side, or even stopping the preflight OPTIONS request from the Ionic app?
NOTE: I am NOT asking how to configure my site to solve a CORS issue, that part is already in place. I want to handle an expected CORS error when it occurs in the app while the supporting API site is being deployed.