Skip to content
Back

Trusting the Appwrite self-signed certificate (Docker localhost) from Android

  • 0
  • Self Hosted
  • Android
LeanderM
10 Nov, 2024, 21:28

I'm trying to connect my Ionic Android application to my locally hosted Appwrite instance. And I'm lost. Android does not allow connecting to http sources, so I set my endpoint to https://<ip>/v1. Which uses Appwrite self-signed certificate.

First, I got:

Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

So I added:

.../src/main/res/xml/network_security_config.xml <?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config> <trust-anchors> <!-- Trust preinstalled CAs --> <certificates src="system" /> <!-- Additionally trust user added CAs --> <certificates src="user" /> </trust-anchors> </base-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">192.168.2.15</domain> <trust-anchors> <certificates src="@raw/traefik_default_cert"/> </trust-anchors> </domain-config> </network-security-config>

and ...android:networkSecurityConfig="@xml/network_security_config"> in my AndroidManifest.xml

traefik_default_cert is the certificate used by Appwrite. I exported it as a .pem file.

Now i'm only getting

[ERROR:ssl_client_socket_impl.cc(878)] handshake failed; returned -1, SSL error code 1, net_error -200

Anyone, please? 🥺

I need support for Docker on Localhost. I can't use cloud instances. (Need complete offline functionaliteit within local network).

TL;DR
Developers are having trouble connecting their Ionic Android application to a locally hosted Appwrite instance due to the self-signed certificate. They tried adding network security configurations in the AndroidManifest.xml file but are now encountering an SSL handshake failure. The issue seems to be related to the certificate validation. Solution: It seems that the SSL handshake failure might still be related to the certificate verification. It's essential to ensure that the certificate is correctly added to the app's trusted certificates. Double-check the certificate setup in the network security configuration and ensure it is correctly referencing the ".pem" file.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more