Never miiiinnnnnddd. Figured it out finally. In the startup script,
the definition of OPTIONS :environment needs to be changed from
''development'' to ''production''. (My use of -e
isn''t actually
implemented by this script.)
On Mar 5, 8:09 am, bob
<bwor...-dPGiaDJmjbSN0YKbF+D8UOTt1fJjkj2Y0E9HWUfgJXw@public.gmane.org>
wrote:> I have an application i''m installing on my application server.
I''ve
> been
> using WEBrick and for now i''d like to just keep using it working
in
> prototype development mode. This works fine on my development machine
> using both http and https, where the host is ''localhost''
(ports
> 3000,3001). It also works fine on the application server http port
> 3000.
> The public/index.html also comes up fine using ssl (port 3001), but
> access
> to pages that call a controller fail with following message:
>
> x.x.66.67 - - [04/Mar/2010:17:28:43 MST] "GET /tags HTTP/1.1" 500
948https://x.x.x.x:3001/-> /tags
>
> ''tags'' is the name of my model, the request for this
error is
> https://x.x.x.x:3001/tags
>
> See below for the full startup of WEBrick, initial index page
> retrieval,
> and then the request for the tags info. Also below is the script
i''m
> using
> to start WEBrick. That''s copied from various examples in various
> blogs. It
> seems popular.
>
> I am NOT running two WEBrick''s, just want to run the one copy, all
> ssl, on
> port 3001, or whatever. I do have tomcat running and serving on 443,
> and
> also an instance of apache. I can''t see why they''d be
involved though.
>
> Using self generated cert.
>
> I''ve been looking at asset_host setting, and anything else i can
> google,
> but i can not find anything that tells me what the problem is. I
> suspect
> it must have something to do with redirection and dropping the
> protocol,
> or rather using http rather than https, or maybe it''s dropping the
> port.
>
> Thanks for any clues, signed, confused (Bob).
>
> ##############################################################
> rr@sevenof9:~/kbrr$ ./script/server_ssl -e production
> => Booting WEBrick...
> => Rails application started onhttps://x.x.x.x:3001
> => Ctrl-C to shutdown
> [2010-03-04 17:27:22] INFO WEBrick 1.3.1
> [2010-03-04 17:27:22] INFO ruby 1.8.6 (2007-09-24) [i486-linux]
> [2010-03-04 17:27:22] INFO
> Certificate:
> Data:
> Version: 1 (0x0)
> Serial Number:
> 80:f2:ab:75:5a:02:94:d7
> Signature Algorithm: sha1WithRSAEncryption
> Issuer: C=US,.... stuff
> Validity
> Not Before: Mar 3 18:28:16 2010 GMT
> Not After : Feb 29 18:28:16 2020 GMT
> Subject: C=US, .......stuff
> Subject Public Key Info:
> Public Key Algorithm: rsaEncryption
> RSA Public Key: (1024 bit)
> Modulus (1024 bit):
> 00:ce:61:6d:39:5f:be:ba:86:c8:b1:20:5b:71:b4:
> etc
> f7:c5:bb:69:d4:31:01:08:07
> Exponent: 65537 (0x10001)
> Signature Algorithm: sha1WithRSAEncryption
> aa:f6:e6:71:aa:d6:d1:3e:b7:46:f6:5c:3d:5a:d3:71:a1:c2:
> etc
> 27:61
> [2010-03-04 17:27:22] INFO WEBrick::HTTPServer#start: pid=8455
> port=3001
> x.x.66.67 - - [04/Mar/2010:17:28:29 MST] "GET / HTTP/1.1" 200
1341
> - -> /
> x.x.66.67 - - [04/Mar/2010:17:28:29 MST] "GET
> /javascripts/prototype.js HTTP/1.1" 200
129738https://x.x.x.x:3001/-> /javascripts/prototype.js
> x.x.66.67 - - [04/Mar/2010:17:28:30 MST] "GET /javascripts/effects.js
> HTTP/1.1" 200 38675https://x.x.x.x:3001/-> /javascripts/effects.js
> x.x.66.67 - - [04/Mar/2010:17:28:43 MST] "GET /tags HTTP/1.1" 500
948https://x.x.x.x:3001/-> /tags
> ##############################################################
>
> ##############################################################
> rr@sevenof9:~/kbrr$ cat script/server_ssl
> #!/usr/bin/env ruby
>
> require File.dirname(__FILE__) + ''/../config/boot''
>
> require ''webrick''
> require ''webrick/https''
>
> puts "=> Booting WEBrick..."
>
> OPTIONS = {
> :port => 3001,
> :ip => "x.x.x.x",
> :environment => (ENV[''RAILS_ENV''] ||
"development").dup,
> :server_root => File.expand_path(RAILS_ROOT + "/public/"),
> :pkey => OpenSSL::PKey::RSA.new(
> File.open(RAILS_ROOT +
> "/config/certs/server.key").read),
> :cert => OpenSSL::X509::Certificate.new(
> File.open(RAILS_ROOT +
> "/config/certs/server.crt").read),
> :server_type => WEBrick::SimpleServer,
> :charset => "UTF-8",
> :mime_types => WEBrick::HTTPUtils::DefaultMimeTypes,
> :debugger => false
>
> }
>
> 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,
> :SSLCertificate => options[:cert],
> :SSLPrivateKey => options[:pkey],
> :SSLCertName => [ [ "CN",
> WEBrick::Utils::getservername ] ]
> )
>
> server.mount(''/'', DispatchServlet, options)
> trap("INT") { server.shutdown }
>
> server.start
> end
> end
>
> puts "=> Rails application started on
> https://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
> puts "=> Ctrl-C to shutdown"
>
> SSLDispatchServlet.dispatch(OPTIONS)
> ##############################################################
>
> ##############################################################
>
> >From the server, ruby -v and rails -v
>
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
> Rails 2.3.5
>
> rr@sevenof9:~/kbrr$
> uname -a Linux sevenof9 2.6.24-26-server #1 SMP Tue Dec 1 19:19:20 UTC
> 2009 i686 GNU/Linux
> ##############################################################
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.