Hi everybody,
we are encoutering a problem using WKWebview in our app when calling our rest services.
We are unable to call our HTTPS domain due to "Preflight fails". We are in cross-origin context, so we have added all required Headers, in fact all was working fine till ios 12 (we are using beta 8).
Safari shows in console:
[Error] Preflight response is not successful
[Error] XMLHttpRequest cannot load https://xxxxxxxxxxxx due to access control checks.
So the OPTIONS calls is failing, even if all the headers (allow-origin etc....) are availables server-side.
Additional informations:
- if we change rest URL to HTTP, all works fine in ios12
- if we use previous version of iOS (9,10,11) all works fine and OPTIONS and GET/POST methods are correclty managed
- we do not use self signed certificates for web services domain
- if we open the same AJAX Rest service Url in Safari (so using GET method) all works fine and no certificates errors are prompt
- the only error that - maybe - could help looking deeply on device log is the following:
Task <1DB0CC48-1C9E-4EDA-BF3A-25D58BAAD09D>.<50> completed with error Error Domain=NSURLErrorDomain Code=-999 UserInfo={NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _NSURLErrorRelatedURLSessionTaskErrorKey=<private>, _NSURLErrorFailingURLSessionTaskErrorKey=<private>, NSLocalizedDescription=<private>} [-999]
Seems to be something related to the domain, but it is very strange because trying to open the same URL using Safari the service returns data correctly (from the same ios12 device).
Any helps?
Thank you!
Marco