I am trying to implement a simple interceptor that allows me to display a message in the lines "cannot connect to server" in my Angular application. However, since the API is on a different host, I deal with CORS requests before flying OPTIONS .
I found that if the API is not available, the Chrome developer tools show 503 in the OPTIONS request, but the Angular $http interceptor gets a 404 response to the next GET request. I believe this is because the OPTIONS response did not contain the required CORS headers, so the GET actually never ran.
Is it possible to intercept the OPTIONS answer? If all I see is 404 , I cannot distinguish "server down" from "no such resource."
angularjs cors
Rob fletcher
source share