iOS 12.0 Beta 1 WKWebview cross origin requests fail - Preflight response is not successful

Originator:joel.kennedy
Number:rdar://40807782 Date Originated:05/06/2018
Status:Open Resolved:
Product:iOS Product Version:12.0 Beta 1
Classification: Reproducible:Always
 
In iOS 12.0 Beta 1, Ajax cross origin requests are failing from WKWebview with the error "Preflight response is not successful. XMLHttpRequest cannot load [url omitted] due to access control checks". This happens even when the remote server is setting "Access-Control-Allow-Origin: *" as a response header.

Steps to Reproduce: Make an Ajax cross origin request from a page running inside WKWebview being served off localhost on a device running iOS 12. Ensure the server being connected to is returning a "Access-Control-Allow-Origin: *" header.

Expected Results: The request should succeed.

Actual Results: The request fails with an error in console: "Preflight response is not successful. XMLHttpRequest cannot load [url omitted] due to access control checks".

Comments

Hi there! Seeing this as well in a bunch of other apps. We're currently tracking this in Ionic here https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112

Seems to be specific to WKWebview

By mikehartington at June 11, 2018, 4:13 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!