Reputation: 4173
I'm looking for a fast and maintainable setup of enforcing SSL in production mode.
Are there any gems for that or what is the best practice here? And what is the easiest way to test this in development?
The app is hosted on Heroku with the SSL-Addon.
Upvotes: 0
Views: 50
Reputation: 1763
In your environments/production.rb
(and / or development.rb
) add the following config:
config.force_ssl = true
This will force app-wide redirects to https
whenever an unsecure URL was requested.
If you want to test this in development, you should set up a self-signed certificate for your local domain (localhost
or my.local
or whatever). For apache you can try something like this, for ngnix something like this.
Upvotes: 3