Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED

Hi. I’m using Unity version 2020.1.6f1 and run on macOS Big Sur(11.2.3).

My app is a mobile application running on Android & iOS.
My app sends GET request to my client’s server and get a result.

It’s been worked well until last month,
but I noticed that it doesn’t work on real Android and iOS devices as well as the Unity editor.

error message is this:

Curl error 51: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_NOT_TRUSTED

but I tested with url “http://google.com”, it’s working

I googled a lot of related things but got no luck.

is my client’s server domain is non-secure? please let me know why this happens.

Here is my code below:

    public static IEnumerator FetchGet(string uri, Action<string> action)
    {
        using (UnityWebRequest webRequest = UnityWebRequest.Get(uri))
        {
            // Request and wait for the desired page.
            yield return webRequest.SendWebRequest();

            if (webRequest.isNetworkError)
            {
                Debug.Log("Error: " + webRequest.error);
                action(null);
            }
            else
            {
                Debug.Log("Received: " + webRequest.downloadHandler.text);
                action(webRequest.downloadHandler.text);
            }
        }
    }

Thanks in advance.

The domain looks to be secure, I don’t have any issues accessing it using web browser. Try accessing it from the devices you have problems with. Such error usually is because of missing root certificate on a device.
The way around is to attach certificate handler to your request and manually validate the certificate.