Golang HTTP x509: certificate signed by unknown authority error

You are doing this:

// NewAPIClient - creates a new API client
func NewAPIClient() Client {
    c := &APIClient{}

    tr := &http.Transport{
        TLSClientConfig: &tls.Config{InsecureSkyVerify: true}, // <--- Problem
    }
    c.client = &http.Client{Transport: tr}
    return c
}

But it is InsecureSkipVerify instead of InsecureSkyVerify.

Be careful however, because InsecureSkipVerify controls whether a client verifies the server’s certificate chain and hostname. If InsecureSkipVerify is true, crypto/tls accepts any certificate presented by the server and any hostname in that certificate. In this mode, TLS is susceptible to machine-in-the-middle attacks unless custom verification is used. This should be used only for testing or in combination with VerifyConnection or VerifyPeerCertificate.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)