9

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?

user1014759
  • 265
  • 3
  • 5
  • 15
  • 1
    I've come across this issue too. The only problem is that your webservice is self signed. If and when you get a correctly signed cert this will not be an issue. For now you can just use HTTP to test. – sciritai Jan 23 '12 at 20:04
  • Thank you! The problem was the self signed cert and it is not an issue with a correctly signed cert. – user1014759 Feb 17 '12 at 18:40

2 Answers2

8

This is a quote from Joe Bowser who wrote the code to allow self signed certs on PhoneGap Android:

  1. 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
  2. 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
  3. 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:

https://issues.apache.org/jira/browse/CB#selectedTab=com.atlassian.jira.plugin.system.project%3Aissues-panel

Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74
1

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.

Community
  • 1
  • 1
Ernests Karlsons
  • 2,220
  • 5
  • 25
  • 37