Home > Article > Backend Development > Why does 'x509: certificate signed by unknown authority' error occur only on Windows XP when using Golang HTTP?
Golang HTTP x509: Certificate Signed by Unknown Authority Error When Running on Windows XP
When accessing a backend using HTTP in Golang, some users encounter the error "x509: certificate signed by unknown authority." It occurs specifically when running the app on Windows XP but not on Windows and Linux.
Upon further investigation, it was found that the certificate is valid and signed by a trusted authority. Additionally, Firefox and Chromium browsers accessed the same URL without issues when run on Windows XP.
One attempted solution involves ignoring the TLS validation by setting InsecureSkyVerify: true in the TLSClientConfig. However, this has proven ineffective.
Proper Solution:
The error message indicates that the issue lies with an unknown authority signing the certificate. Ensure that the certificate is signed by a trusted authority and that the correct certificate is being used.
Mistaken Solution:
The code provided attempts to set InsecureSkyVerify: true, but the correct parameter is InsecureSkipVerify.
Caution:
Using InsecureSkipVerify should be done with caution as it disables TLS validation and makes the client susceptible to man-in-the-middle attacks. It should only be used for testing purposes or in conjunction with VerifyConnection or VerifyPeerCertificate for custom verification.
The above is the detailed content of Why does 'x509: certificate signed by unknown authority' error occur only on Windows XP when using Golang HTTP?. For more information, please follow other related articles on the PHP Chinese website!