Running a dotnet 8.0.202 in linux (Rocky OS) with Nginx webserver. We have proxied the internal dotnet service running at localhost:5000 to https://example.com and everything seems to be working fine.
We are using letsencrypt with Nginx for SSL.
When we are calling paypal URL for payment process at https://api-m.sandbox.paypal.com/ application throws error by saying
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
I have tried to implement this, but didn’t worked:
bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
// Always return true to bypass SSL certificate validation
sslPolicyErrors = SslPolicyErrors.None;
return true;
}
// Set the certificate validation callback before making the API call
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(RemoteCertificateValidationCallback);
Can someone please give me some more debugging tips?
Many thanks in advance.