Chrome Asks to "Select a Certificate" for Ssl on My Rails App Using Thin

Verified Certificate with thin server

Check thin version, in older version this was the issue https://github.com/macournoyer/thin/issues/244
Chrome asks to "Select a Certificate" for SSL on my Rails app using thin

They have resolved it in new version https://rubygems.org/gems/thin/versions/2.0.0.pre

How can I have a clean output with thin and ssl?

When launching Thin with the command:

rails server thin

The possible options are propagated from Rack to thin in Rack::Server#start:

server.run wrapped_app, options

But in Rack::Handler::Thin#run, we can see that the handler doesn't use those options:

 module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
yield server if block_given?
server.start
end
end
end
end

When using Thin in ssl mode via the command line:

thin start --ssl

Options are parsed in Thin::Runner#parser and then used in Controllers::Controller#start

I would suggest to monkey patch Rack::Handler::Thin#run with a content similar to Controllers::Controller#start.

The result would be something like this:

  module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
server.ssl = true
server.ssl_options = { :private_key_file => PATH_TO_KEY_FILE, :cert_chain_file => PATH_TO_CERT_FILE }
yield server if block_given?
server.start
end
end
end
end

Rails app accessible from LAN machine using IP address, but not Bonjour name?

Problem solved.

I'm using Snow Leopard and disabling IPv6 was all that was required for it to work it would seem.

Also of note, publishing the service was not required, mainly because it didn't need to be discovered.



Related Topics



Leave a reply



Submit