Here is how to start your Rails application to accept both HTTP and HTTPS in development.
-
gem install passenger
-
Create a self-signed SSL certificate. Store the generated files in config/passenger-standalone-ssl.
-
Create a Passengerfile.json at the project root with this content (or save the attached file):
{ "ssl": true, "ssl_port": 3001, "ssl_certificate": "config/passenger-standalone-ssl/server.crt", "ssl_certificate_key": "config/passenger-standalone-ssl/server.key" }
If you just want to run Passenger without a config file, use this command to start Passenger:
passenger start --ssl --ssl-port 3001 --ssl-certificate config/passenger-standalone-ssl/server.crt --ssl-certificate-key config/passenger-standalone-ssl/server.key
-
passenger start
-
Connect to
https://localhost:3000/
for HTTP, tohttps://localhost:3001/
for HTTPS.
Warnings from chrome might not be accurate
Even though the certificate is working locally, chrome might still complain that the certificate is not valid and the connection is not secure while blotting out the "https" part of the url.
Posted by Arne Hartherz to makandra dev (2015-08-11 16:47)