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

Murugan Andezuthu Dharmaratnam | 17 August 2021 | 1088

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);