Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pat/thin-glazed

SSL Proxy for HTTP Thin servers
https://github.com/pat/thin-glazed

Last synced: 17 days ago
JSON representation

SSL Proxy for HTTP Thin servers

Awesome Lists containing this project

README

        

h1. Thin::Glazed

This library adds an HTTPS proxy to Thin, which allows you to run your Rails apps that use both HTTP and HTTPS protocols simply within a browser, as well as in your Capybara integration tests, should you so desire.

It was written to keep things consistent - with SSL in development, test and production environments.

This wouldn't have been possible (or at least, would have been a far larger headache) if it wasn't for the source and examples of the em-proxy gem.

h2. Installation

Add this line to your application's Gemfile, in your development and/or test groups:

gem 'thin-glazed'

h2. Using it in development

You can use the glazed server when you fire up your Rails app locally:

./script/rails server thin_glazed

This will provide HTTPS over port 3443 - I use "my fork":https://github.com/freelancing-god/ssl_requirement of the bartll-ssl_requirement gem to specify which ports have which protocols, at the end of my @config/environments/development.rb@ file:

SslRequirement.non_ssl_port = 3000

SslRequirement.non_ssl_port = 3443

This ensures redirects from one protocol to the other work accordingly.

If you want to have this as your default development server, add a @:require@ option to the listing in your Gemfile:

gem 'thin-glazed', :require => 'thin/glazed/as_default'

And from there, it'll just work:

./script/rails server

h2. Using it with tests

*Note*: this currently has a dependency on "my fork":https://github.com/freelancing-god/ssl_requirement of bartll-ssl_requirement. I'd love some suggestions on instructing Rails on what the HTTP and HTTPS ports are without external requirements.

It should just work, if you're using straight Capybara, or Capybara with Selenium. For Webkit, you'll want to use @:glazed_webkit@ instead of @:webkit@ for your javascript driver:

Capybara.javascript_driver = :glazed_webkit

h2. Using it in production

Don't. This isn't built for production - you'd be far better served with a tool like Pound, or really just letting Nginx or Apache handle it all for you.

h2. Contributing

* Fork it
* Create your feature branch (`git checkout -b my-new-feature`)
* Write your tests
* Write the code to make your tests pass
* Commit your changes (`git commit -am 'Added some feature'`)
* Push to the branch (`git push origin my-new-feature`)
* Create new Pull Request

h2. Credits

Copyright (c) 2012, Thin::Glazed was a Rails Camp New Zealand project, and is developed and maintained by Pat Allan. It is released under the open MIT Licence.