rails 3.2.3 在 ubuntu 12.0.4 中使用 webrick 无法在 https 上工作 [英] rails 3.2.3 doesn't work on https using webrick in ubuntu 12.0.4

查看:53
本文介绍了rails 3.2.3 在 ubuntu 12.0.4 中使用 webrick 无法在 https 上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一直在尝试使用 ubuntu 12.0.4 中的 webrick 获得一个全新的、刚刚创建的 rails 应用程序来处理 ssl.

Have been trying to get a fresh, just created rails application to work on ssl using webrick in ubuntu 12.0.4.

已经尝试了我知道的所有可能的方法.尝试在 application.rb 中使用 config.force_ssl = true,也在 application controller 中使用 force_ssl.

Have tried all possible methods that I'm aware of. Tried using config.force_ssl = true in application.rb, also force_ssl in application controller.

出于某些原因,当我在 Firefox 上使用 https://loacalhost:3000 时,我收到一条错误消息,内容为:

For some reasons, when I use https:// loacalhost:3000 on firefox I get an error message saying,

###An error occurred during a connection to localhost:3000.###
###SSL received a record that exceeded the maximum permissible length.###
###(Error code: ssl_error_rx_record_too_long)###

在谷歌浏览器中,错误信息是,

In google chrome the error message is,

SSL connection error### ###Unable to make a secure connection to the server. This may be a problem with the server.or it may be requiring a client authentication certificate that you don't have.

服务器日志显示,

[2012-07-22 16:26:04] ERROR bad URI `�D/i�b���\\��)�F6��ѡ���c���"�\e\x00\x00H\x00��'.
[2012-07-22 16:26:47] ERROR bad Request-Line `\x16\x03\x01\x00�\x01\x00\x00�\x03\x01P\v�onC��\x1D��\x16\x16R!NU�����\r'�\x05���
w��\x00\x00H\x00��'.

还尝试使用 webrick 和乘客在生产模式下运行应用程序.没有帮助.

Have also tried running the application on production mode with webrick and also with passenger. No help.

看起来与未将公钥传递给客户端有关.不过我可能错了.

Looks like something to do with the public key not being delivered to the client. I might be wrong though.

推荐答案

您在开发模式下使用的服务器似乎没有向客户端提供 ssl 证书.

The servers which you have used in dev mode doesn't seem to provide an ssl certificate to the client.

出于开发目的,您可以使用Thin",因为如果您使用以下命令启动服务器,它会提供 ssl 证书:

For dev purposes you can use "Thin" as it provides a ssl certificate if you start the server with the following command:

瘦开始--ssl"而不是通常的:

"thin start --ssl" instead of the usual:

"rails s/rails 服务器"

"rails s/rails server"

这篇关于rails 3.2.3 在 ubuntu 12.0.4 中使用 webrick 无法在 https 上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆