I\'ve been doing a lot of research and could not find a way to handle this. I\'m trying to perform a jQuery ajax call from an https server to a locahost https server running
I don't think there's currently a way to detect these error messages, but a hack that you can do is to use a server like nginx in front of your application server, so that if the application server is down you'll get a bad gateway error from nginx with 502 status code which you can detect in JS. Otherwise, if the certificate is invalid you'll still get the same generic error with statusCode = 0.