Android: trust user-installed CAs next to the system ones — a self-hosted server behind a private CA could not be reached from the app (#213)

This commit is contained in:
Duarte Santos committed 2026-09-17 11:37:56 +02:00
1 parent 113e7ef755
commit b95561e957
2 files changed
+16

No files matched your search

@@ -6,6 +6,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Issue #213: a self-hosted server behind a private CA (Caddy "tls internal", a home PKI).
Since API 24 an app trusts system CAs only, so the WebView refused the handshake while
Chrome on the same phone, which honours user-installed CAs, opened the server fine.
Trust both. A user CA is something the owner of the phone installed on purpose, behind a
system warning; this is the same trust the browser already gives it. Cleartext is left at
the platform default (off). -->
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>