Forum: Ruby on Rails Basic (newbie) Webrick / ssl config question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Greg F. (Guest)
on 2006-01-16 18:13
(Received via mailing list)
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
        http://wrath.rubyonrails.org/pipermail/rails/2005-...
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
--
Greg F.
The Norcross Group
Forensics for the 21st Century
Zayne K. (Guest)
on 2006-01-19 21:55
(Received via mailing list)
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/server.secure (see below) to launch the https servlet.

[script/server.secure]
#!c:/ruby/bin/ruby
require File.dirname(__FILE__) + '/../config/boot'
#require 'commands/server'

require 'webrick'
require 'webrick/https'


OPTIONS = {
  :port        => 3001,
  :ip        => "127.0.0.1",
  :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 = WEBrick::HTTPServer.new(:Port        =>
options[:port].to_i,
                     :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 }
    server.start
  end
end
puts "=> Rails application started on
http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
puts "=> Ctrl-c to shutdown"


SSLDispatchServlet.dispatch(OPTIONS)
Greg F. (Guest)
on 2006-01-20 02:30
(Received via mailing list)
Greatly appreciated.

I will try it out tomorrow.

Greg
On 1/19/06, Zayne K. <removed_email_address@domain.invalid> wrote:
> #require 'commands/server'
>
> class SSLDispatchServlet < DispatchServlet
>     server.mount('/', DispatchServlet, options)
>
> >
> >
>
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
Greg F.
The Norcross Group
Forensics for the 21st Century
This topic is locked and can not be replied to.