iOS v12 Https请求错误 [英] iOS v12 Https requests errors
问题描述
我注意到从iOS v12上的Ionic Angular应用发出的https请求分别失败,并且永远无法到达我的后端.
I noticed that https requests made from my Ionic Angular app on iOS v12 are failing respectively never reach my backend.
我可以确认我的应用程序具有生产力,并且仅在iOS> = v12上会出现此错误
I could confirm that my app is productive and the fact that this error only occurs on iOS >= v12
当我在Xcode 10 beta中调试时,出现以下错误
When I debug in Xcode 10 beta I get the following error
{标头":{"normalizedNames":{},"lazyUpdate":null,标头":{}},"status":0,"statusText":未知错误","url":null ,"ok":false,名称":"HttpErrorResponse","message":(失败的url)Http失败响应:0未知的错误","error":{"isTrusted":true}}
{"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url): 0 Unknown Error","error":{"isTrusted":true}}
我的Node/Express.js后端设置了以下标头
My Node / Express.js backend set the following headers
var allowedOrigins = ["https://example.com", "http://ionic.local", "http://localhost:8080"];
var origin = req.headers.origin;
if(allowedOrigins.indexOf(origin) > -1){
res.setHeader('Access-Control-Allow-Origin', origin);
} else {
res.setHeader("Access-Control-Allow-Origin", "https://example.com");
}
res.header("Access-Control-Allow-Credentials", "true")
res.header("Access-Control-Allow-Headers", "Origin, Authorization, Content-Type, Content-Range, Content-Disposition, Content-Description, X-Requested-With, X-ACCESS_TOKEN");
res.header("Access-Control-Allow-Methods", "GET,PUT,POST");
有人面临同样的问题吗? 您在代码中做了哪些更改以解决iOS v12的问题?
Anyone is facing the same problem? What did you change in your code to fix the problem for iOS v12?
P.S .: 我已经打开了苹果的一个问题
P.S.: I have opened an issue by Apple
这里也是Ionic论坛上的链接主题: https ://forum.ionicframework.com/t/ios-12-beta-preflight-requests-fail
Also here the linked subject on the Ionic forum: https://forum.ionicframework.com/t/ios-12-beta-preflight-requests-fail
以防万一在WkWebView插件上出现了一个问题: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112
And just in case opened an issue on the WkWebView plugin: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112
更新
我不确定,但是看起来我只在分别查询 POST 请求时遇到问题,而我在执行GET请求时却没有遇到问题...您也可以确认吗?
I'm not sure but it looks like that I only face issue while querying POST requests respectively that I don't face it while doing GET requests...could you confirm that too?
更新2
在以下讨论/问题中, https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112 ,我们也押注iOS版本本身的错误.让我们看看它是否会在下一个Beta版本中得到纠正
In the following discussion/issue, https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/112, we are also betting on a bug in the iOS version itself. Let see if it will be corrected with the next beta version
更新3
Xcode 10 beta 2
和iOS 12 beta 2
分别于2018年6月19日星期二发布,解决了我的问题
Xcode 10 beta 2
respectively iOS 12 beta 2
released Tuesday 19th June 2018 solved my problem
推荐答案
问题是iOS 12 beta 1
Xcode 10 beta 2
和iOS 12 beta 2
分别于2018年6月19日星期二发布,解决了我的问题
Xcode 10 beta 2
respectively iOS 12 beta 2
released Tuesday 19th June 2018 solved my problem
这篇关于iOS v12 Https请求错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!