Created
May 21, 2014 15:18
-
-
Save davidtolsma/7fc2db3299ce61c916fb to your computer and use it in GitHub Desktop.
Enable https for rails development environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initially done in Rails 4.1, add the following to config/boot.rb | |
require 'webrick' | |
require 'webrick/https' | |
require 'rails/commands/server' | |
module Rails | |
# Override default development | |
# Server port | |
class Server | |
def default_options | |
super.merge({ | |
Port: 3000, | |
SSLEnable: true, | |
SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE, | |
SSLPrivateKey: OpenSSL::PKey::RSA.new(File.open(".ssl/localhost.key").read), | |
SSLCertificate: OpenSSL::X509::Certificate.new(File.open(".ssl/localhost.crt").read), | |
SSLCertName: [["CN", WEBrick::Utils::getservername]] | |
}) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment