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-January/001993.html 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 Freemyer 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/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) On 1/16/06, Greg Freemyer <greg.freemyer@gmail.com> wrote:> > 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-January/001993.html > 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 Freemyer > The Norcross Group > Forensics for the 21st Century > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060119/04b8fd9f/attachment.html
Greatly appreciated. I will try it out tomorrow. Greg On 1/19/06, Zayne Knight <zanytheking@gmail.com> wrote:> 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) > > > On 1/16/06, Greg Freemyer <greg.freemyer@gmail.com> wrote: > > > > 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-January/001993.html > > 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 Freemyer > > The Norcross Group > > Forensics for the 21st Century > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Greg Freemyer The Norcross Group Forensics for the 21st Century