Basic (newbie) Webrick / ssl config question

I have a simple Intranet app I want to make accessible via the
Internet for remote access by our employees.

I want to use ssl (https) connections and I’ve found enough messages
to imply Webrick as included in rails can do the job.

The message at
even appears to tell me exactly how to do it by modifying “server”.

The trouble is my “script/server” is a very simple 3 line script the
runs “commands/server”.

Where do I find “commands/server”?

And if I only want the production environment to run SSL is that
easily accomplished?


Greg F.
The Norcross Group
Forensics for the 21st Century

There might be a better way (if so, somebody say!), but for development
(winxp) I use two iWEBrick servlets – one https servlet and one http
servlet (on different ports)

Currently, I use script/server to launch the http servlet and
script/ (see below) to launch the https servlet.

require File.dirname(FILE) + ‘/…/config/boot’
#require ‘commands/server’

require ‘webrick’
require ‘webrick/https’

:port => 3001,
:ip => “”,
:environment => (ENV[‘RAILS_ENV’] || “development”).dup,
:server_root => File.expand_path(RAILS_ROOT + “/public/”),


ENV[“RAILS_ENV”] = OPTIONS[:environment]
RAILS_ENV.replace(OPTIONS[:environment]) if defined?(RAILS_ENV)

require RAILS_ROOT + “/config/environment”
require ‘webrick_server’
OPTIONS[‘working_directory’] = File.expand_path(RAILS_ROOT)

class SSLDispatchServlet < DispatchServlet
def self.dispatch(options)
Socket.do_not_reverse_lookup = true
server = =>
:ServerType => options[:server_type],
:BindAddress => options[:ip],
:SSLEnable => true,
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
:SSLCertName => [ [ “CN”,
WEBrick::Utils::getservername ] ]
server.mount(’/’, DispatchServlet, options)
trap(“INT”) { server.shutdown }
puts “=> Rails application started on
puts “=> Ctrl-c to shutdown”


Greatly appreciated.

I will try it out tomorrow.

On 1/19/06, Zayne K. [email protected] wrote:

#require ‘commands/server’

class SSLDispatchServlet < DispatchServlet
server.mount(’/’, DispatchServlet, options)

Rails mailing list
[email protected]

Greg F.
The Norcross Group
Forensics for the 21st Century

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs