You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
RudyOnRails edited this page Dec 1, 2012
·
7 revisions
The examples below only show how to make devise views into SSL. Since Rails uses a cookie for its sessions, it is recommended that the entire website should use SSL for security reasons.
For Devise 1.0, one way to do sign_in over SSL is:
# in app/controllers/application_controller.rbclassApplicationController < ActionController::BaseincludeSslRequirement
...
end# in config/environment.rbconfig.to_preparedoSessionsController.ssl_required:new,:createRegistrationsController.ssl_required:new,:createend
If the code above just requires ssl on the first request in development, you may need to move the last line to a config.to_prepare block inside config/application.rb or config/environment.rb:
Rails 3.1 no longer needs the ssl_requirement gem. Just place this in your environment file:
#in config/environments/production.rbconfig.to_prepare{Devise::SessionsController.force_ssl}config.to_prepare{Devise::RegistrationsController.force_ssl}config.to_prepare{Devise::PasswordsController.force_ssl}# or your customized controller, extending from Devise
And make sure to enable SSL on the server (Nginx, Apache, etc.). If the servers are not configured properly, Rails will not recognize the request as SSL (even if it is), and cause an infinite redirect loop.