【问题标题】:Puma mini SSL error while connecting to rails server连接到 Rails 服务器时 Puma mini SSL 错误
【发布时间】:2020-08-08 13:41:02
【问题描述】:

每次我尝试连接到服务器时,Rails 服务器都会引发 SSL 错误。

[34087] Puma starting in cluster mode...
[34087] * Version 4.3.3 (ruby 2.6.5-p114), codename: Mysterious Traveller
[34087] * Min threads: 10, max threads: 10
[34087] * Environment: development
[34087] * Process workers: 1
[34087] * Phased restart available
[34087] * Listening on tcp://0.0.0.0:3001
[34087] * Listening on ssl://0.0.0.0:3000?cert=config/ssl.crt&key=config/ssl.key&verify_mode=none&no_tlsv1=false&no_tlsv1_1=false
[34087] Use Ctrl-C to stop
[34087] * Starting control server on unix:///tmp/puma-status-1596893456509-34087
[34087] - Worker 0 (pid: 34120) booted, phase: 0
2020-08-08 19:03:16 +0530: SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:14209102:SSL routines:tls_early_post_process_client_hello:unsupported protocol - 337678594>

ssl 证书和密钥已经从 Rails 服务器的配置中提供,但即便如此我仍然收到 ssl 错误

【问题讨论】:

    标签: ruby-on-rails openssl ssl-certificate puma


    【解决方案1】:

    只需将我的应用设置为在本地开发环境中使用 SSL 运行。我采取的步骤:

    1. 在您的项目文件夹的根目录中创建证书:

    $ openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt

    1. 像这样启动 rails 服务器:

    $ rails s -b 'ssl://localhost:3000?key=localhost.key&amp;cert=localhost.crt'

    Source

    也许这可以帮助你。在您的情况下,您可能会省略第一步,只需编辑步骤 2 中的 rails s 命令,并使用您的 localhost.keylocalhost.crt 文件的正确路径。

    还可以提一下,在我的config/environemnts/development.rb 文件末尾我添加了: config.force_ssl = true

    不确定是否有必要。

    【讨论】:

    • 我之前已经尝试过了,但它对我不起作用。
    猜你喜欢
    • 2016-09-25
    • 2016-09-13
    • 1970-01-01
    • 2015-05-28
    • 1970-01-01
    • 2011-06-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多