Skip to content

Instantly share code, notes, and snippets.

@davidtolsma
Created May 21, 2014 15:18
Show Gist options
  • Save davidtolsma/7fc2db3299ce61c916fb to your computer and use it in GitHub Desktop.
Save davidtolsma/7fc2db3299ce61c916fb to your computer and use it in GitHub Desktop.
Enable https for rails development environment
# 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