Thiago
Thiago

Reputation: 2258

setting up ssl on devise

I'd like to require ssl authentication for the user resource on devise. I was expecting that to be as simple as it is in rails, like:

  devise_for :users, :constraints => { :protocol => "https" }

Also, I couldn't find any documentation on devise's github, though I've found some dead links pointing to it at the google groups.

Does anybody has a hint on how to get it working easily? I thought I'd be simple, given the popularity of the plugin

Upvotes: 17

Views: 6998

Answers (3)

pjammer
pjammer

Reputation: 9577

Integrate SSL Requirement into your app and using Devise. The answer didn't work but this did for me, especially since I was using SSL Requirement already.

Upvotes: 7

José Valim
José Valim

Reputation: 51429

:constraints won't work as option, but this probably will:

constraints :protocol => "https" do
  devise_for :users
end

Upvotes: 14

Andy Lindeman
Andy Lindeman

Reputation: 12165

I suggest using Rack::SSL, maybe with Rack::SslEnforcer for more configuration options.

Upvotes: 2

Related Questions