s

open policy agent OPA The remote certificate is invalid because of errors in the certificate chain UntrustedRoot edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 17 August 2021 | 1504

HttpClient.SendAsyncCore One or more errors occurred. (The SSL connection could not be established, see inner exception.). The remote certificate is invalid because of errors in the certificate chain UntrustedRoot.

Solution

Solution is to Bypass the certificate using below code

            HttpClientHandler clientHandler = new HttpClientHandler();
            clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };

            var httpClient = new HttpClient(clientHandler);