Ajax cross origin requests always failing in wkwebview

Ajax cross origin requests are failing from WKWebview with the error "Preflight response is not successful. XMLHttpRequest cannot load (the url) due to access control checks".

Error in console: Preflight response is not successful. XMLHttpRequest cannot load (the url) due to access control checks.





Here is the request log caught by charles:



URL https://www.xxxxxx.com

Status Failed

Failure SSLHandshake: Remote host closed connection during handshake

Response Code -

Protocol HTTP/1.1

SSL TLSv1.2 (TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) [h2]

Method CONNECT

Kept Alive No

Content-Type -

Client Address /xx.xx.xx.xx

Remote Address https://www.xxxxxx.com/xxx.xxx.xxx.xxx

Connection

Connection #1765093527

Timing

Request Start Time 6/12/18 11:43:25

Request End Time -

Response Start Time -

Response End Time 6/12/18 11:43:25

Duration 127 ms

DNS 1 ms

Connect 28 ms

SSL Handshake 37 ms

Request -

Response -

Latency -

Speed 1.64 KB/s

Request Speed -

Response Speed -

Size

Request 213 bytes

Header 213 bytes

Query String -

Cookies -

Body -

Uncompressed Body -

Compression -

Response -

Header -

Cookies -

Body -

Uncompressed Body -

Compression -

Total 213 bytes

Ajax cross origin requests always failing in wkwebview
 
 
Q