`URLSessionConfiguration.connectionProxyDictionary` Fails to Disable HTTP(s) Proxy on iOS 26.2

This thread has been locked by a moderator; it no longer accepts new replies.

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
Answered by DTS Engineer in 885899022

I’m happy to focus this discussion on your other thread.

Share and Enjoy

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

Boost

please delete this one because I create another one. https://developer.apple.com/forums/thread/824361

I’m happy to focus this discussion on your other thread.

Share and Enjoy

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

`URLSessionConfiguration.connectionProxyDictionary` Fails to Disable HTTP(s) Proxy on iOS 26.2
 
 
Q