7

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.

4

1 回答 1

14

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"

于 2012-07-23T14:08:46.700 回答