【问题标题】:Heroku Hobby Dyno: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR, server verification OK but ALPN server does not agree to protocolHeroku Hobby Dyno:连接建立错误:net::ERR_SSL_PROTOCOL_ERROR,服务器验证正常但 ALPN 服务器不同意协议
【发布时间】:2018-11-27 12:56:57
【问题描述】:

我有一个简单的应用程序,客户端通过 wss 连接在页面加载时发送加入 websocket 通道的请求。我已将我的应用程序部署到域 my_app.heroku.com 的 heroku。每当我打开我的网站时,我都会收到错误 Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR。我知道这是一个 SSL 问题,而且要使用 Heroku 的 SSL,您必须使用业余爱好者帐户。所以,我将应用程序升级为爱好者(一天前),但它并没有解决问题。

我已经用谷歌搜索了这个问题,从我看到的情况来看,除了升级到 Heroku Hobby 之外,似乎只有在使用自定义域名时才需要进行其他设置,而我不是。如何使用 Hobby dyno 让 SSL 在我的 my_app.heroku.com 域上工作?

编辑:如果我运行curl -vI <my_app>.heroku_app.com,我会得到以下信息:

curl -vI https://<my_app>.herokuapp.com
* Rebuilt URL to: https://<my_app>.herokuapp.com/
*   Trying __.___.___.___...
* Connected to <my_app>.herokuapp.com (__.___.___.___) port 443
(#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*        server certificate verification OK
*        server certificate status verification SKIPPED
*        common name: *.herokuapp.com (matched)
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: C=US,ST=California,L=San Francisco,O=Heroku\, Inc.,CN=*.herokuapp.com
*        start date: Wed, 19 Apr 2017 00:00:00 GMT
*        expire date: Mon, 22 Jun 2020 12:00:00 GMT
*        issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2
High Assurance Server CA
*        compression: NULL
* ALPN, server did not agree to a protocol
> HEAD / HTTP/1.1
> Host: <my_app>.herokuapp.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: Cowboy
Server: Cowboy
< Connection: keep-alive
Connection: keep-alive
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Content-Length: 1154
Content-Length: 1154
< Date: Thu, 22 Nov 2018 08:39:51 GMT
Date: Thu, 22 Nov 2018 08:39:51 GMT
< Via: 1.1 vegur
Via: 1.1 vegur

【问题讨论】:

  • 您是否尝试按照here 的说明手动上传证书?
  • @jusermar10 我没有,但我运行了curl -vI &lt;my_app&gt;.heroku_app.com 并且服务器证书验证正常,所以我认为手动上传不会解决问题,因为似乎已经有 SSL 证书?我已将 curl 跟踪添加到主帖子的编辑中

标签: ssl heroku websocket heroku-ssl


【解决方案1】:

终于找到this question后找到了答案。我一直认为问题是由于在 Heroku 上设置 SSL 证书,但这是由于我的客户端代码。根据我所遵循的教程,WS 连接是“wss://my_app.herokuapp.com:80/subscribe”。删除端口号是解决方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-23
    • 2021-12-05
    • 2020-11-18
    • 2023-03-13
    • 2021-06-01
    • 2011-09-26
    • 2014-05-21
    • 2011-11-11
    相关资源
    最近更新 更多