rails 3.2.3 doesn't work on https using webrick in ubuntu 12.0.4

荒凉一梦 提交于 2019-12-10 13:05:41

问题


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

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.

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.

The server log shows,

[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��'.

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.


回答1:


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

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

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

"rails s/rails server"



来源:https://stackoverflow.com/questions/11599992/rails-3-2-3-doesnt-work-on-https-using-webrick-in-ubuntu-12-0-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!