go auth_error ai_generated true

错误:x509:证书由未知权威机构签名

error: x509: certificate signed by unknown authority

ID: go/net-http-https-certificate-unknown-authority

其他格式: JSON · Markdown 中文 · English
80%修复率
87%置信度
0证据数
2026-09-01首次发现

版本兼容性

版本状态引入弃用备注
1.20 active
1.21 active

根因分析

服务器的TLS证书不是由受信任的证书颁发机构签名的,通常由于自签名证书。

English

The server's TLS certificate is not signed by a trusted Certificate Authority, often due to self-signed certificates.

generic

解决方案

  1. 95% 成功率 Add custom CA certificate to transport
    caCert, _ := os.ReadFile("ca.crt")
    caCertPool := x509.NewCertPool()
    caCertPool.AppendCertsFromPEM(caCert)
    transport := &http.Transport{TLSClientConfig: &tls.Config{RootCAs: caCertPool}}

无效尝试

常见但无效的做法:

  1. Setting InsecureSkipVerify to true globally 20% 失败

    Security risk; use custom root CA instead.