doumeilmikv7099 2018-02-01 03:01
浏览 40

前往SSL侦听器

I'm building a rest API in Go. I have an SSL domain and one dedicated server.

The domain points to my dedicated and works fine (https://www.myweb.com).

The error is when I'm making a request to some EndPoint of my API I do never get a response from the server.

func main() {
    router := NewRouter()

    handler := cors.New(cors.Options{
        AllowedMethods:   []string{"GET", "POST", "PUT", "DELETE", "PATCH"},
        AllowCredentials: true,
        AllowedOrigins:   []string{"*"},
        AllowedHeaders:   []string{"Authorization", "Content-Type", "Access-Control-Allow-Request-Method"},
    }).Handler(router)


    log.Fatal(http.ListenAndServeTLS(":4433", "tls.crt", "tls.key", handler))

}

routes.go:

var routes = Routes{    Route{"Index", "GET", "/", Index}, }
func NewRouter() *mux.Router {
    fmt.Println("[INFO] Loading EndPoints...")
    router := mux.NewRouter().StrictSlash(true)
    for _, route := range routes {
        router.
            Methods(route.Method).
            Path(endPoint + route.Pattern).
            Name(route.Name).
            Handler(route.HandlerFunc).Headers()

    }
    fmt.Println("[INFO] EndPoints loaded successfully...")

    return router
}

Index function

func Index(w http.ResponseWriter, r *http.Request) {

    fmt.Println("API IS RIGHT HERE latest")
    w.WriteHeader(http.StatusOK)
    w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
    w.Write([]byte("This is an example server.
"))

}

The problem is that I can see 'API IS RIGHT HERE latest' in the console but nothing else. I mean, the response is not loading. This is the POSTMAN message enter image description here

UPDATE

I just noticed that If I use the link and join over Firefox browser then the response works okay. But if I request the same URL from POSTMAN then I don't get a response.

UPDATE 2

I just disabled SSL Verification from POSTMAN and now works fine. But I wanna know what really means this option? Because I bought an SSL Certificate (It's not a self-signed)

enter image description here

  • 写回答

1条回答 默认 最新

  • douwan4993 2018-02-02 13:55
    关注

    I just disabled the SSL Verification in Chrome and the response works. But I wannt know why I had to do this? It's not a self-signed certificate. I bought this one.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题