Ending “cleartext not permitted” — real HTTPS from phone to home server

One design change resolved an entire class of connection errors.

← All projects

The problem

My phone companion app kept losing its link to my home server: “cleartext not permitted,” “no pairing data.” The app used plain HTTP and had the server's IP address baked in. Android blocks plain HTTP by default, and every address change meant a rebuild.

The fix

Testing lesson

The certificate belongs to the name, not the IP. Testing by IP fails with a hostname mismatch even when everything is healthy. The right test pins the name to the IP so the certificate is still checked.

Takeaway

Fix the design, not the symptom.