I am working on an iOS project.
In this application, I am downloading images from the server.
Problem:
While downloading images I a
CORS in my case.
I had such response in a iOS app once. The solution was the missing Access-Control-Allow-Origin: *
in the headers.
More: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
There is no HTTP status code 0. What you see is a 0 returned by the API/library that you are using. You will have to check the documentation for that.
We got the error:
GET http://localhost/pathToWebSite/somePage.aspx raised an http.status: 0 error
That call is made from windows task that calls a VBS file, so to troubleshoot the problem, pointed a browser to the url and we get a Privacy Error:
Your connection is not private
Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID
Automatically report details of possible security incidents to Google. Privacy policy Back to safety This server could not prove that it is localhost; its security certificate is from *.ourdomain.com. This may be caused by a misconfiguration or an attacker intercepting your connection. Learn more.
This is because we have a IIS URL Rewrite rule set to force connections use https. That rule diverts http://localhost to https://localhost but our SSL certificate is based on an outside facing domain name not localhost, thus the error which is reported as status code 0. So a Privacy error could be a very obscure reason for this status code 0.
In our case the solution was to add an exception to the rule for localhost and allow http://localhost/pathToWebSite/somePage.aspx to use http. Obscure, yes, but I'll run into this next year and now I'll find my answer in a google search.
In iOS SDK When your API call time-outs, you get status 0 for that.
Status code '0' can occur because of three reasons
1) The Client cannot connect to the server
2) The Client cannot receive the response within the timeout period
3) The Request was "stopped(aborted)" by the Client.
But these three reasons are not standardized
From my limited experience, I would say that the following two scenario could cause response status code: 0
, keep in mind; their could be more, but I know of those two:
the thing is, status: 0
is slightly generic, and their could be more use cases that trigger an empty response body.