pyromaniac / secure_routes

Routing-level ssl support for ruby application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SecureRoutes

Warning! Proof of concept.

Secure routes is routing-level support for ssl in your rails 3 application.

Installation

To install simply add this to your Gemfile:

gem 'secure_routes'

Then you need to enable secure routing in your environment config:

config.action_dispatch.secure_routes = true

Usage

If you want your action to force https protocol, add this to routes:

match 'login' => 'sessions#new', :secure => true

Or

scope :secure => true do
  match 'login' => 'sessions#new'
end

And if you’ll try to access host.com/login then you’ll be redirected to host.com/login

To force http protocol, just set :secure => false. Redirection rules works here too. If protocol is unnesesary - don’t set :secure option.

You can setup secure actions usage with:

config.action_dispatch.secure_routes = true

in your environment. It is false by default. So you can use securing for production only.

To spec it just clone repo, then:

bundle && rake spec

About

Routing-level ssl support for ruby application

License:MIT License


Languages

Language:Ruby 100.0%