Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 584
Thiago Avatar asked Jan 21 '11 18:01

Thiago


People also ask

How do I set up SSL?

Under Install and Manage SSL for your site (HTTPS), click Manage SSL Sites. Scroll down to the Install an SSL Website and click Browse Certificates. Select the certificate that you want to activate and click Use Certificate. This will auto-fill the fields for the certificate.

Where can I find SSL certificate on server?

For most browsers, look to see if a site URL begins with “https,” which indicates it has an SSL certificate. Then click on the padlock icon in the address bar to view the certificate information.


3 Answers

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

constraints :protocol => "https" do
  devise_for :users
end
like image 96
José Valim Avatar answered Sep 18 '22 13:09

José Valim


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.

like image 30
pjammer Avatar answered Sep 19 '22 13:09

pjammer


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

like image 31
Andy Lindeman Avatar answered Sep 17 '22 13:09

Andy Lindeman