프로그래밍/닷넷
HttpClient에서 Proxy 세팅 시 Host 헤더를 추가하면 발생하는 오류 해결 : System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
흑우마스터
2023. 4. 16. 21:12
var handler = new HttpClientHandler
{
Proxy = new WebProxy(proxyUri),
UseProxy = true,
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
//DefaultProxyCredentials = proxyCredentials
};
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
해당 코드를 추가하지 않으면 오류가 발생함.