I used the following code to connect to a proxy server and works fine only for HTTP requests, but not for HTTPS. IOS 9.0 depreciates kCFStreamPropertyHTTPSProxyHost and kCFStreamPropertyHTTPSProxyPort .
let myPortInt = 12345; let myProxyUrlString = "myProxyURL"; let sessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration(); sessionConfiguration.connectionProxyDictionary = [ kCFNetworkProxiesHTTPEnable: true, kCFNetworkProxiesHTTPPort: myPortInt, kCFNetworkProxiesHTTPProxy: myProxyUrlString, ] let url = NSURL(string: endPointUrl) let postRequest = NSMutableURLRequest(URL: url!, cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, timeoutInterval: 10.0) let jsonString = bodyString postRequest.HTTPBody = jsonString postRequest.HTTPMethod = "POST" postRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") let session = NSURLSession(configuration: sessionConfiguration) let task = session.dataTaskWithRequest(postRequest){}
source share