Add security with HTTPS
Public, Rails General
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