Prior to Rails 3, you could modify the script/server file to add in SSL parameters and tell the server command to use the HTTPS version of WEBrick. Now that all of those scr
As an alternative to trying to set up WEBrick to use HTTPS/SSL for your Rails app, you can try switching to using the Thin server instead, because it comes with convenient options for setting up HTTPS/SSL out-of-the-box.
First, add Thin as a gem to your Gemfile:
gem 'thin'
Then run bundle install from the command line.
If you just want to test your Rails app using HTTPS/SSL in your local development environment, then you simply run
thin start --ssl
I have to emphasize that this is not suitable for production environments, because you need to use a valid SSL certificate from a Certificate Authority in order for SSL/HTTPS connections to be verifiable and secure.
There are also other options that you can pass to Thin. You can get a full list of them by running thin --help. For example, I like to specify my own ip-address and port, as well as daemonizing Thin into a background process:
thin start --ssl \
--address \
--port \
--daemonize
If you want to tell Thin to use an SSL certificate (for example, one that you've obtained from a valid Certificate Authority), then you can use these options:
thin start --ssl \
--ssl-cert-file \
--ssl-key-file