colly icon indicating copy to clipboard operation
colly copied to clipboard

x509: certificate signed by unknown authority

Open xjin opened this issue 4 years ago • 4 comments

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?

xjin avatar Jul 11 '20 07:07 xjin

My browser says the certificate is valid.

xjin avatar Jul 11 '20 07:07 xjin

My curl says it's not.

This is not colly problem, and not even Go language problem. Go simply uses system certificates.

WGH- avatar Jul 23 '20 14:07 WGH-

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.

asalih avatar Sep 21 '20 20:09 asalih

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

la-ci avatar Oct 27 '20 10:10 la-ci