0

Anyone encountered this error? kCFErrorDomainCFNetwork error 311?

I wrote a simple cordova application running in iPad (iOS 9 up). This applications calls an HTTPS api but throws this error kCFErrorDomainCFNetwork error 311.

Pleas note that the HTTPS Server has a valid CA Issued SSL Certificate.

I googled a lot on this error but without any luck and only managed to found this cfStreamErrorHTTPSProxyFailureUnexpectedResponseToCONNECTMethod that has an int value of 311 and it says that

The HTTPS proxy returned an unexpected status code, such as a 3xx redirect

Indeed the resource that i am invoking is returning a 302 which unfortunately i have no control of.

And to access the https server, i have to specifically connect to a wifi proxy where the IP address is whitelisted in the https server.

I hope someone from this great community could provide me some light on this error.

Thank you.

s4m0k
  • 568
  • 1
  • 4
  • 12

1 Answers1

2

I also have received the same error. The problem is that you are accessing network through a proxy which needs to be authenticated before you send a request. In your case, generally if you are accessing internet in the system browser, you might have proxy settings(along with authentication) in your browser or system preferences -> network -> Advanced -> Proxies. In order to address the authentication issues while URL requests, Apple has given documentation in this regard - https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/AuthenticationChallenges.html. For a simple model implementation just refer to Simple example of NSURLSession with authentication

Community
  • 1
  • 1
Avinash B
  • 1,485
  • 13
  • 14