Add security with HTTPS
Public, Rails General
harrylevine
Created: Jul 19, 2015 Updated: Jul 20, 2015
Simply use config.force_ssl = true in your environment configuration.
You can also selectively enable https depending on the current Rails environment. For example, you might want to keep HTTPS turned off on development, and enable it on staging/production.
# config/application.rb
module MyApp
class Application < Rails::Application
config.force_ssl = false
end
end
# config/environments/production.rb
MyApp::Application.configure do
config.force_ssl = true
end
http://simonecarletti.com/blog/2011/05/configuring-rails-3-https-ssl/