Skip to content

Instantly share code, notes, and snippets.

@masone
Created August 21, 2014 10:10
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save masone/5955f4cc0b4d4ef372db to your computer and use it in GitHub Desktop.
Save masone/5955f4cc0b4d4ef372db to your computer and use it in GitHub Desktop.
Thin with SSL as default server for use with rails server. Works with Rubymine.
#!/usr/bin/env ruby
require 'rack'
# Thin SSL workaround
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] || 3000,
app)
server.ssl = true
server.ssl_options = {
:private_key_file => SERVER_KEY,
:cert_chain_file => SERVER_PEM
}
yield server if block_given?
server.start
end
end
end
end
# Workaround end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
@beydogan
Copy link

beydogan commented May 7, 2015

Its working with RubyMine 6.3.3. Thank you.

Also you can pass private_key_file and cert_chain_file as nil

  server.ssl_options = {
            :private_key_file => nil,
            :cert_chain_file => nil
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment