Last active
February 1, 2023 03:59
-
-
Save giulio92/32d86abdba734606819021add814a71d to your computer and use it in GitHub Desktop.
NSURLSession Proxy configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sessionConfiguration: URLSessionConfiguration = .default | |
let proxyConfiguration: [AnyHashable : Any] = [ | |
kCFNetworkProxiesHTTPEnable as AnyHashable: true, | |
kCFNetworkProxiesHTTPPort as AnyHashable: [Place-proxy's-port-number-here], | |
kCFNetworkProxiesHTTPProxy as AnyHashable: "Place-your-proxy-address-here" | |
] | |
sessionConfiguration.connectionProxyDictionary = proxyConfiguration | |
let session: Foundation.URLSession = Foundation.URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can we set https proxy to URLSession?