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

Regression?

I'm having this problem with iOS 12 now - see https://stackoverflow.com/questions/52434011/how-to-fix-ios-12-safari-cors-preflight-error?noredirect=1#comment91847506_52434011

I've reported it here https://bugreport.apple.com/web/?problemID=44621834

and it is duped here https://bugreport.apple.com/web/?problemID=42546319

but I cannot see that ticket

By user1gguser1gg at Sept. 24, 2018, 1:45 p.m. (reply...)

It look like Xcode 10 beta 2 respectively iOS 12 beta 2 solves the issue...it deserves a try

By flusterfluster at June 19, 2018, 9:05 p.m. (reply...)

Yes, in iOS 12 Beta 2 this is fixed.

I have the same issue with WKWebView and iOS 12 Beta 1.

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!