• HttpsURLConnection sub domain connect problem

    From Jakub@jak74@interia.pl to comp.mobile.android on Wed Mar 11 14:51:12 2026
    From Newsgroup: comp.mobile.android


    welcome

    I have this code at android studio


    val url = URL(destinationUrl)

    var httpsURLConnection : HttpsURLConnection = url.openConnection() as HttpsURLConnection


    when i put at destinationUrl this https://jakub1.pl

    it is work


    but when i put destinationUrl this https://contact.jakub1.pl

    show error like this

    I IOException -> java.security.cert.CertPathValidatorException: Trust
    anchor for certification path not found.

    Ofcourse have installed certific at both domain and sub domain.

    how to fix it?

    How to connect sub domain?

    thanks for answer

    Jakub
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Andy Burns@usenet@andyburns.uk to comp.mobile.android on Wed Mar 11 17:50:27 2026
    From Newsgroup: comp.mobile.android

    Jakub wrote:

    when i put at destinationUrl this https://jakub1.pl
    it is work

    Works from firefox on windows, using your wildcard certificate

    but when i put destinationUrl this https://contact.jakub1.pl

    also works from widows, but is using a different certificate, is that
    what you intended?

    show error like this Trust anchor for certification path not found

    Both those hostnames resolve to the same IP, so the client will have to support SNI to differentiate the two hostnames/certificates

    You need to force add a "host:" header to the request, something like ...

    val url = new URL("https://contact.jakub1.pl")
    HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestProperty("Host", "contact.jakub1.pl");
    conn.connect();

    --- Synchronet 3.21d-Linux NewsLink 1.2