We are trying to block HTTP requests in WKWebView using App Transport Security: NSAllowsArbitraryLoads. However, it is not working in the below mentioned scenario
Step 1: Set NSAllowsArbitraryLoads as 'false' in Info.plist. Load an HTTP request in WKWebView. The request is blocked as expected
Step 2: Set NSAllowsArbitraryLoads as 'true' in Info.plist. Load the same HTTP request in WKWebView. The request is loaded successfully in the webview as expected.
Step 3: Set NSAllowsArbitraryLoads as 'false' in Info.plist. Load the same HTTP request in WKWebView. The request is loaded successfully instead of blocking the request.
Note: Just to ensure this is not happening due to cache issue, we also tried by setting the cache policy of the request as URLRequest.CachePolicy.reloadIgnoringLocalAndRemoteCacheData. However, this is not helping us to resolve the issue.
Could you help us resolve this issue?
Update 1: Added screenshot of the info.plist App Transport Security setting and webview load request method
Update 2: URL Request
- url : http://www.httpurl.com/
- cachePolicy : 4
- timeoutInterval : 60.0
- mainDocumentURL : nil
- networkServiceType : C.NSURLRequestNetworkServiceType
- allowsCellularAccess : true
- httpMethod: GET
- allHTTPHeaderFields : nil
- httpBody : nil
- httpBodyStream : nil
- httpShouldHandleCookies : true
- httpShouldUsePipelining : false