简体   繁体   English

获取 https://<mydomain.com> /translate/2327496366232: x509: 由未知机构签署的证书&quot;

[英]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.

相关问题 由未知机构签署的 x509 证书 - go-pingdom - x509 certificate signed by unknown authority - go-pingdom Apache X509 证书认证模式设置 HTTP 标头 - Apache X509 certificate auth mode setting HTTP headers 如何在自签名服务器和客户端证书上调用 https get 方法 - How to call the https get method on a self signed server and client certificate 给定“ www.mydomain.com”-如何确定网站是否支持https - Given “www.mydomain.com” - how to determine if site supports https 有没有办法获得 spring 引导 API 的证书以从 http 转换为 Z5E056C000A1C48BADE51 以外的自签名证书? - Is there a way to get a certificate for spring boot API to convert from http to https other than self signed certificates? 使用自签名证书将http转换为https - converting http to https using self signed certificate 信任用于HTTPS连接的自签名证书 - Trust a self-signed certificate for a HTTPS connection 具有CA证书问题的HTTPS SSL自签名证书 - HTTPS SSL Self-Signed Certificate with CA Certificate issue X509Certificate和.NET Compact Framework 3.5 - X509Certificate and .NET Compact Framework 3.5 Microsoft Edge 强制 HTTPS 并拒绝自签名证书 - Microsoft Edge forcing HTTPS and refusing a self-signed certificate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM