使用自签名证书对 HTTPS 服务器进行 PhoneGap Ajax 调用失败
我对phonegap 比较陌生,最近我在我的windows apache 服务器上使用自签名证书设置了HTTPS/SSL,并尝试发出HTTPS ajax post 请求。该请求在浏览器中运行时工作正常,但在phonegap 中运行时失败。我尝试将 android:debuggable 设置为 false 但这并没有解决问题。我还做了一些研究,看来phonegap确实支持HTTPS ajax请求,所以我很困惑为什么请求失败。
有谁知道为什么会这样?
I am relatively new to phonegap and I have recently set up HTTPS/SSL on my windows apache server with a self signed certificate and am trying to make an HTTPS ajax post request. The request works fine when ran in a browser but fails when run within phonegap. I tried setting android:debuggable to false but that did not fix the issue. I have also done some research and it appears that phonegap does support HTTPS ajax requests so I am confused as to why the request is failing.
Does anyone know why this could be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 Joe Bowser 的一句话,他编写了允许在 PhoneGap Android 上进行自签名证书的代码:
所以看来您应该能够通过设置 android:debuggable="true" 来完成您想要的操作。如果这对您不起作用,我们需要向您提供重现方案、PhoneGap 版本以及您正在使用的 Android 版本。
也许最好为我们提出 Jira 中的错误:
https://issues.apache.org/jira/browse/CB#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel
This is a quote from Joe Bowser who wrote the code to allow self signed certs on PhoneGap Android:
So it seems like you should be able to do what you want by setting android:debuggable="true". If that isn't working for you we'll need to get a reproduction scenario from you, the version of PhoneGap and the version of Android you are using.
Probably best to raise a bug in Jira for us:
https://issues.apache.org/jira/browse/CB#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel
我在这个问题上花了几个小时,直到我发现有一个快速而肮脏的修复可能。它涉及重写
CordovaWebViewClient
以忽略证书错误。I spent hours on this issue until I found that there is a quick and dirty fix possible. It involves overriding
CordovaWebViewClient
to ignore certificate errors.