iOS 14 httpsProxy Error Domain=kCFErrorDomainCFNetwork Code=310

xcode version:12.2

I was using NSURLSessionConfiguration @property connectionProxyDictionary on iOS 14. When creating a https proxy server, I found that the https request response was 403 and Error Domain=kCFErrorDomainCFNetwork Code=310 。what should I do?
this is my demo code:

NSDictionary *proxyConfig = @{
      @"HTTPSEnable" : @(1),
      @"HTTPSProxy"  : EmailProxyIP,
      @"HTTPSPort"   : @(443)};

    NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
    sessionConfig.connectionProxyDictionary = proxyConfig;
    sessionConfig.HTTPShouldSetCookies = YES;
    sessionConfig.HTTPMaximumConnectionsPerHost = 1;
    sessionConfig.HTTPCookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
  NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
  NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www..com"];

  NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:
                 ^(NSData *data, NSURLResponse *response, NSError *error) {
                  
                   if (error) {
                   NSLog(@"Failed === Response:%@ %@\n", response, error);
                   }
                   NSString* newStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                   NSLog(@"%@",newStr);
                 }];
  [task resume];
In the context of the kCFErrorDomainCFNetwork domain, error 310 is kCFErrorHTTPSProxyConnectionFailure. I recommend that you use an RVI packet trace to look at what’s happening on the ‘wire’. See Recording a Packet Trace.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
iOS 14 httpsProxy Error Domain=kCFErrorDomainCFNetwork Code=310
 
 
Q