I am currently developing an app using WKWebView. In iOS 17, Apple introduced ProxyConfiguration, and I have two questions regarding its usage:
- Is there a way to use ProxyConfiguration to distinguish between HTTP and HTTPS traffic?
I have reviewed the documentation but couldn’t find a clear method for this. As an alternative approach, I am attempting to determine the request scheme within WKWebView and switch proxyConfigurations just before loading the request. My current implementation sends requests to hoge_a by default and switches to hoge_b only for HTTP traffic.
if #available(iOS 17.0, *) {
if URLString.contains("http:") {
webView.configuration.websiteDataStore.proxyConfigurations = [hoge_b]
}
}
webView.load(request)
if #available(iOS 17.0, *) {
if URLString.contains("http:") {
webView.configuration.websiteDataStore.proxyConfigurations = [hoge_a]
}
}
2. Since I modify proxyConfigurations every time webView.load(request) is called, are there any potential issues or concerns with this approach?
I would appreciate any insights you may have on either of these questions.