简体   繁体   中英

Ruby on Rails WEBrick SSL connection error

Please help to implement ssl

rails version - 3.2.8

I edtited following files:

# Gemfile
gem 'rack-ssl'

 # config/application.rb
require 'rack/ssl'
config.middleware.use Rack::SSL

I also tried to use

# config/application.rb
config.force_ssl = true

But it shows

SSL connection error

when I access mysite:3000/

But it shows normal page if going to https:mysite

Please help,

thanks,

D

According to this:

How to use deactivate Webrick's SSL

The issue is caused by config.force_ssl = true . Even if you remove that, which you may not want, you might still have issues with WEBrick giving you this error. You could try clearing cookies, but that still might not work.

A better alternative, if it's an option for you, would be to switch to using the thin server:

group :development do
   gem "thin"
end

Then:

$ bundle
$ thin start --ssl

See also https://stackoverflow.com/a/11614213

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM