PhoneGap的Ajax和自签名证书调用HTTPS服务器失败 [英] PhoneGap Ajax call to HTTPS server with self-signed certificate fails
问题描述
我是比较新的PhoneGap的,我最近成立了HTTPS / SSL在我的Windows Apache服务器使用自签名的证书,并想使一个HTTPS AJAX POST请求。请求工作正常运行的浏览器,但在PhoneGap的运行时出现故障时。我尝试设置的android:可调试,以错误的,但是这并没有解决问题。我也做了一些研究,似乎PhoneGap的不支持HTTPS的Ajax请求让我很困惑,为什么请求失败。
有谁知道这可能是为什么?
这是从乔·库巴报价是谁写的code,允许在PhoneGap的Android的自签名的证书:
- 如果你在做开发:机器人:可调试在清单=真,你应该让浏览器请求服务器上的数据 与自签名或坏的SSL证书
- 如果您正在发布一个应用程序,你应该删除了android:可调试=真(Android Market的不会让你释放与 这对无论如何),你将不能够将数据发送到服务器 错误的SSL证书
- 如果您还没有该标志设置,默认会是怎样的默认值是现在,这是你无法将数据发送到 使用自签名的证书服务器
所以好像你应该能够做你想做的通过设置的android:可调试=真。如果不为你工作,我们需要从你得到了再现的情况下,PhoneGap的版本和Android的您正在使用的版本。
可能是最好的提高JIRA中的错误给我们:
<一个href="https://issues.apache.org/jira/browse/CB#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel">https://issues.apache.org/jira/browse/CB#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel
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?
This is a quote from Joe Bowser who wrote the code to allow self signed certs on PhoneGap Android:
- If you are doing development: android:debuggable="true" in the manifest, you should allow the browser to request data from servers with a self-signed or bad SSL cert
- If you are releasing an application, you should remove the android:debuggable="true" (Android Market won't let you release with this on anyway) and you will NOT be able to send data to a server with a bad SSL cert
- If you don't have this flag set, the default will be what the default is now, which is that you won't be able to send data to servers with a self-signed cert
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:
这篇关于PhoneGap的Ajax和自签名证书调用HTTPS服务器失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!