Skip to content

Instantly share code, notes, and snippets.

@webdev
Forked from simi/rails.rb
Created August 31, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdev/0fc8f313c76bbfd1dfc0439b54f6f14b to your computer and use it in GitHub Desktop.
Save webdev/0fc8f313c76bbfd1dfc0439b54f6f14b to your computer and use it in GitHub Desktop.
Rails 3.1.1 Webrick with SSL support
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'
module Rails
class Server < ::Rack::Server
def default_options
super.merge({
:Port => 3000,
:environment => (ENV['RAILS_ENV'] || "development").dup,
:daemonize => false,
:debugger => false,
:pid => File.expand_path("tmp/pids/server.pid"),
:config => File.expand_path("config.ru"),
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLPrivateKey => OpenSSL::PKey::RSA.new(
IO.read(File.expand_path("vendor/ssl/gs.key"))),
:SSLCertificate => OpenSSL::X509::Certificate.new(
IO.read(File.expand_path("vendor/ssl/gs.crt"))),
:SSLCertName => [["CN", WEBrick::Utils::getservername]]
})
end
end
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment