2

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

lulalala
  • 17,572
  • 15
  • 110
  • 169
Dmitry Sterh
  • 81
  • 2
  • 11

1 Answers1

9

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

Community
  • 1
  • 1
Josh Rieken
  • 2,256
  • 1
  • 19
  • 23