[英]Get https://<mydomain.com>/translate/2327496366232: x509: certificate signed by unknown authority"
In my Go App, I make a call to Hostname+"/translate/12345
在我的 Go 应用程序中,我拨打了
Hostname+"/translate/12345
Thing is depending the environment, in local Hostname
will be on http, and in production, it will be on https
事情取决于环境,在本地
Hostname
名将在 http 上,在生产中,它将在https
When I test the production route on https with postman, there is no problem, route works fine.当我使用 postman 在 https 上测试生产路由时,没有问题,路由工作正常。
But when I run it from WS, I get:但是当我从 WS 运行它时,我得到:
Get https://<mydomain.com>/translate/2327496366232: x509: certificate signed by unknown authority"
Here is my code:这是我的代码:
var terID string
client := http.Client{}
req, err := http.NewRequest("GET", Hostname+"/translate/"+terID, nil)
if err != nil {
return "", err
}
req.SetBasicAuth(Username, Password)
res, err := client.Do(req)
if err != nil {
return "", err
}
What can I do to fix that ?我能做些什么来解决这个问题?
According to https://github.com/andygrunwald/go-jira/issues/52 , please try根据https://github.com/andygrunwald/go-jira/issues/52 ,请尝试
import ("net/http"; "crypto/tls")
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify : true},
}
client := &http.Client{Transport: tr}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.