草庐IT

ssl - GOlang/https : timeout waiting for client preface

coder 2023-06-29 原文

我使用 ListenAndServeTLS 切换了 SSL

    func main() {
        serverMux := http.NewServeMux()
        serverMux.HandleFunc("/v1/ws1", handler1)

        serverMux.HandleFunc("/v1/ws2", handler2)
        serverMux.HandleFunc("/v1/ws3", handler3)

        serverMux.HandleFunc("/static/", handlerStatic(http.FileServer(http.Dir("/var/project/"))))
        go func() {
            wsSSLServer := &http.Server{
                Addr:         ":443",
                Handler:      serverMux,
                ReadTimeout:  15 * time.Second,
                WriteTimeout: 15 * time.Second,
            }
            certPath := "/etc/letsencrypt/live/example.com/"
            fmt.Println(wsSSLServer.ListenAndServeTLS(certPath+"fullchain.pem", certPath+"privkey.pem"))
        }()
        wsServer := &http.Server{
            Addr:         ":80",
            Handler:      serverMux,
            ReadTimeout:  15 * time.Second,
            WriteTimeout: 15 * time.Second,
        }
        fmt.Println(wsServer.ListenAndServe())
    }

现在我在日志中收到很多这样的错误:

http2: server: error reading preface from client x.x.x.x:xxxxx: timeout waiting for client preface

这是什么意思?

最佳答案

我在使用 Firefox 作为客户端时遇到了同样的错误。 重新生成 SSL key /证书解决了问题,我猜证书已过期。

对于本地主机开发: openssl req -nodes -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days XXX -subj '/CN=localhost'

关于ssl - GOlang/https : timeout waiting for client preface,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37733840/

有关ssl - GOlang/https : timeout waiting for client preface的更多相关文章

  1. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  2. Ruby SSL 错误 - sslv3 警报意外消息 - 2

    我正在尝试在ruby​​脚本中连接到服务器https://www.xpiron.com/schedule。但是,当我尝试连接时:require'open-uri'doc=open('https://www.xpiron.com/schedule')我收到以下错误消息:OpenSSL::SSL::SSLError:SSL_connectreturned=1errno=0state=SSLv2/v3readserverhelloA:sslv3alertunexpectedmessagefrom/usr/local/lib/ruby/1.9.1/net/http.rb:678:in`conn

  3. ruby - 如何在非 SSL 或 http 网站上使用 Stripe? - 2

    我正在使用Rails3.2.6和Stipe进行支付。是否有可能在不购买ssl证书的情况下进行付款。我可以使用Stripe页面作为我的支付页面吗? 最佳答案 您可以使用stripe.js在技术上跳过SSL但我强烈建议您设置SSL。它所做的是将信用卡信息直接传递给stripe,然后stripe会给你一个token,用于实际进行收费。这样做意味着信用卡信息永远不会接触您的服务器,您不必担心PCI合规性。但是,您仍应设置SSL以防止中间人攻击。您可以在https://stripe.com/docs/tutorials/forms找到有关如何

  4. ruby - HTTP POST 上的 SSL 错误(未知协议(protocol)) - 2

    尝试通过SSL连接到ImgurAPI时出现错误。这是代码和错误:API_URI=URI.parse('https://api.imgur.com')API_PUBLIC_KEY='Client-ID--'ENDPOINTS={:image=>'/3/image',:gallery=>'/3/gallery'}#Public:Uploadanimage##args-Theimagepathfortheimagetoupload#defupload(image_path)http=Net::HTTP.new(API_URI.host)http.use_ssl=truehttp.verify

  5. ruby - 警告 : PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, 请参阅 : https://github. com/wayneeseguin/rvm/issues/3212 - 2

    我每次打开终端时都会收到这个错误:警告:PATH设置为RVMruby​​但未设置GEM_HOME和/或GEM_PATH,请参阅:https://github.com/wayneeseguin/rvm/issues/3212这是在我最近安装zsh(oh-my-zsh)后开始发生的我不知道如何设置GEM_HOME和/或GEM_PATH的路径。 最佳答案 我也面临同样的问题,更改.zshrc中的以下行,exportPATH="/usr/local/heroku/bin:.........."到exportPATH="$PATH:/usr/

  6. ruby - ssl`sysread_nonblock' : end of file reached (EOFError) - 2

    我编写了一个使用ruby​​线程的代码。require'rubygems'require'net/http'require'uri'defget_response()uri=URI.parse('https://..........')http=Net::HTTP.new(uri.host,uri.port)http.use_ssl=true----------endt1=[]15.timesdo|i|t1[i]=Thread.new{hit_mdm(i)sleep(rand(0)/10.0)}endt1.each{|t|t.join}代码工作正常,但是当程序执行到最后时它会抛出以下错

  7. ruby - 使用 Ruby/Puma 的本地 SSL - 2

    我正在运行本地puma服务器,但无法在SSL下加载资源。我有一个本地签名的证书。我正在尝试使用以下配置运行服务器:puma-b'ssl://127.0.0.1:9292?key=/path/to/certs/localhost.unecrypted.key&cert=/path/to/certs/localhost.crt'现在,当我访问https://localhost:9292或https://127.0.0.1:9292时,浏览器只是旋转并且没有来自服务器的响应。不返回任何资源。它两次向我显示HTML标题标签,但几乎总是什么也得不到。有什么想法吗?其他想法?确实需要在本地运行此应

  8. ruby-on-rails - ruby open ssl api for encrypted key (without nodes option) - 2

    在安装了openssllib的linux机器上,当您执行带有“-nodes”选项的“opensslpkcs12”时,您将获得带有未加密私钥的输出,但如果您跳过–nodes选项,则输出将具有加密的私钥。e.g.opensslpkcs12-intest.pfx-outtest.pem你应该看到像下面这样加密的私钥-----BEGINENCRYPTEDPRIVATEKEY-----MIIFDjBABgkqhkiGG7s=-----ENDENCRYPTEDPRIVATEKEY-----如何使用ruby​​的开放ssl库实现上述目标?这就是我用ruby​​生成私钥的方式:@private_key

  9. ruby - 如何获得带有 SSL 客户端证书的 HTTPS 请求以与 Ruby EventMachine 一起使用? - 2

    我正在尝试使用RubyEventMachine访问使用SSL证书身份验证的HTTPSWeb服务,但我没有让它工作。我编写了以下简单代码块来对其进行端到端测试:require'rubygems'require'em-http'EventMachine.rundourl='https://foobar.com/'ssl_opts={:private_key_file=>'/tmp/private.key',:cert_chain_file=>'/tmp/ca.pem',:verify_peer=>false}http=EventMachine::HttpRequest.new(url).g

  10. ruby-on-rails - 萨翁 SSL 问题 - 2

    我正在努力让Savongem连接到我们的一台服务器。我不断收到一条错误消息,指出我无法通过ssl。我已经阅读了许多教程和修复程序,但似乎都没有用。感谢任何帮助-如果我能度过它,这将成为我的星期一:-)。错误:D,[2011-06-20T09:43:02.002993#10328]DEBUG--:RetrievingWSDLfrom:http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdlD,[2011-06-20T09:43:02.129057#10328]DEBUG--:HTTPIexecutesHTTPGETusing

随机推荐