I'm trying to load WKWebView by running a local server (PerfectHTTPServer), and serving files from the documents folder in the iPhone application. The path is correct since this works with a server launched with Swifter. This is code snippet I use to launch the server
try HTTPServer.launch(name: "localhost", port: 9009, documentRoot: serverPath)
The error that is returned in console is:
[INFO] Starting HTTP server localhost on :::9009
2018-05-01 15:03:54.929275+0530 WebViewTest[18991:1997516] [BoringSSL] Function nw_protocol_boringssl_input_finished: line 1386 Peer disconnected during the middle of a handshake. Sending errSSLFatalAlert(-9802) alert
2018-05-01 15:03:54.934444+0530 WebViewTest[18991:1997516] TIC TCP Conn Failed [1:0x103090350]: 3:-9802 Err(-9802)
2018-05-01 15:03:54.935133+0530 WebViewTest[18991:1997516] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
I did some research and found that Apple recommends to use NSAllowsLocalNetworking, to get around similar problem. However, this still doesn't help in my case. I've also tried to introduce 'Exception Domains' and provide localhost, which works for Swifter, but not for Perfect.
Has anybody else faced a similar issue, or, can provide any pointers?
My environment is
XCode: 9.2 (9C40b),
iOS: 11.2.5,
PerfectHTTPServer: 3.0.15 (Tag),
Swift: 3.2
Thanks.