Heroku Hobby Dyno:连接建立错误:net::ERR_SSL_PROTOCOL_Error,服务器验证正常



我有一个简单的应用程序,客户端在页面加载时通过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

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

相关内容

最新更新