colly
colly copied to clipboard
x509: certificate signed by unknown authority
Very basic code ` func main() { c := colly.NewCollector()
// Find and visit all links
c.OnHTML("*", func(e *colly.HTMLElement) {
fmt.Println(e)
e.Request.Visit(e.Attr("href"))
})
c.OnRequest(func(r *colly.Request) {
fmt.Println("Visiting", r.URL)
})
c.CheckHead = false
err := c.Visit("https://cs.utsa.edu/people/faculty")
if err != nil {
fmt.Printf("Done with error %s", err.Error())
}
} `
But I was given "x509: certificate signed by unknown authority" on the first visit. Any clue why?
My browser says the certificate is valid.
My curl says it's not.
This is not colly problem, and not even Go language problem. Go simply uses system certificates.
This is working on windows including curl and chrome but not working on ubuntu so it seems like there is a problem with ssl certificate. The command curl -kvI https://cs.utsa.edu/people/faculty on ubuntu shows the problem which says; SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
Well, IMHO the current browsers are coming with pre-loaded root + intermediate certificates for some sites. So unless you make sure you have loaded root and full-chain certificates to trusted certificate store used by curl, or any other system application, you will see this error. Browsers read the system wide plus their local trust cert store