Send requests through a proxy with the Network library

How can I send requests through a proxy with the Network library?

With URLSession this could be done through the configuration like:

configuration.connectionProxyDictionary = [
  kCFNetworkProxiesHTTPEnable as String: 1,
  kCFNetworkProxiesHTTPProxy as String: ip,
  kCFNetworkProxiesHTTPPort as String: port,
  "HTTPSEnable": 1,
  "HTTPSProxy": ip,
  "HTTPSPort": port,
]

Is it possible to do something similar with the Network library?

No. The only knob you have to twiddle here is the preferNoProxies property, but that just enables and disables support for the standard proxy settings, it doesn’t let you override them.

If you’d like to see us support this facility in the future, I encourage you to file an enhancement request describing your requirements and explaining your rationale for those requirements.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Send requests through a proxy with the Network library
 
 
Q