Our business interface requests require disabling HTTP(s) proxies. We configured URLSessionConfiguration.connectionProxyDictionary as before, but found that it does not work on iOS 16.2 and 16.3.1.
1.Core code:
let configuration = URLSessionConfiguration.default
configuration.connectionProxyDictionary = [
"HTTPEnable": false,
"HTTPSEnable": false,
"SOCKSEnable": false,
]
let session = URLSession(configuration: configuration)
let request = URLRequest(url: URL(string: "https://www.baidu.com")!,timeoutInterval: Double.infinity)
// 发送请求
let task = session.dataTask(with: request) { data, response, error in
if let error = error {
print("网络请求失败: \(error)")
}
if let data = data {
print("网络请求成功,返回数据长度: \(data.count)")
if let responseString = String(data: data, encoding: .utf8) {
print("返回数据: \(responseString.prefix(100))...")
}
}
}
task.resume()
2.Specific steps:
We captured traffic using Proxyman and Charles. With the same code, requests cannot be captured on iOS 18 and iOS 16.1, but can be captured on iOS 26.2 and 26.1.
Conclusion:Therefore, we suspect there is a bug with URLSessionConfiguration.connectionProxyDictionary on iOS 26.x. Please let us know whether this is a bug. If not, how should we properly disable HTTP(s) proxies?
Note: We need to exclude PAC proxies, which are commonly used in corporate internal networks.
3.Devices & Soft
- Xcode 16.4
- iPhone 26.2、Simulator 26.1
- Proxyman、Charles