Skip to content

Instantly share code, notes, and snippets.

@giulio92
Last active February 1, 2023 03:59
Show Gist options
  • Save giulio92/32d86abdba734606819021add814a71d to your computer and use it in GitHub Desktop.
Save giulio92/32d86abdba734606819021add814a71d to your computer and use it in GitHub Desktop.
NSURLSession Proxy configuration
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)
@gavaliswapnil
Copy link

Can we set https proxy to URLSession?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment