When initializing Parse
on Android
, I am able to successfully connect to the Parse server when:
1) I don't specify a server URL, or
2) I set the server URL to the Parse server.
Because we intend to ultimately migrate our data from Parse to a different host, we would like to connect to a different server URL.
However, when I try to specify a different server URL (https://api.ourhostname.com/1/) that redirects (serves as a proxy) to the Parse server, the app fails to connect to the server altogether. When implemented from the iOS project, this server URL works fine. However, when implemented on the Android equivalent:
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId(APP_ID)
.clientKey(CLIENT_KEY)
.server("https://api.ourhostname.com/1/")
.build()
);
I receive an i/o failure:
05-24 21:46:55.319 7140-7140/com.ourapp W/System.err: com.parse.ParseRequest$ParseRequestException: i/o failure
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:290)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:145)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:139)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at bolts.Task$15.run(Task.java:917)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.lang.Thread.run(Thread.java:818)
05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: Caused by: javax.net.ssl.SSLPeerUnverifiedException: Cannot verify hostname: api.ourhostname.com
05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at android.net.SSLCertificateSocketFactory.verifyHostname(SSLCertificateSocketFactory.java:242)
05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:486)
05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at com.android.okhttp.Connection.upgradeToTls(Connection.java:1226)
05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at com.android.okhttp.Connection.connect(Connection.java:1183)
...
From a web browser, I am able to visit our custom server URL, which is trusted and valid from the browser, meaning it is not self-signed.
Has anyone else encountered this problem from their Android project, and any suggestions on how to successfully get the Parse SDK to connect to a custom server URL?
UPDATE:
We were able to fix this problem via:
1) Adding this solution on the Android side.
2) Adjusting how our custom server serves its public keys (which was especially crucial in enabling Marshmallow to connect to the server).
We were able to fix this problem via:
1) Adding this solution on the Android side.
2) Adjusting how our custom server serves its public keys (which was especially crucial in enabling Marshmallow to connect to the server).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With