Is there a way to configure WKWebView to go through a HTTP Proxy server? I know this is possible with NSURLSession directly, but I want to configure it so that all requests through the WKWebView browser go through a proxy.
相关问题
- Angular RxJS mergeMap types
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- RMI Threads prevent JVM from exiting after main()
- Is a unicode user agent legal inside an HTTP heade
NSURLSessionConfiguration has a direct interface(connectionProxyDictionary) to do that , so it can be done easily
But, WkWebView does not have any direct interface like that,it requests ,renders the content out-of-process and so you can imagine like WkWebview instance is sandboxed from the rest of your app
WkWeView even ignores the cookies(NSHTTPCookieStorage), caches(NSURLCache) and Credentials(NSCredentialStorage) of NSURLSession & NSURLConnection likewise these network classes can't access cookies,caches and credentials of WkWebView instance.
The UIWebView does not do it out-of-process and so you can use NSURLProtocol as demonstrated in CustomHTTPProtocol sample to proxy to a server.
As of iOS 10, still there is no support for NSURLProtocol in WkWebView so you can't proxy using WkWebView.
If your proxy server supports tunnelling(VPN) then you can use NetworkExtension.framework and its classes(NEVPNManager, NEVPNProtocol, NEVPNConnection etc..) to direct all the network traffic of your app through your proxy server.