# SSL on Rails 3

**URL:** <https://www.ruby-forum.com/t/ssl-on-rails-3/195661>\
**Category:** Rails\
**Created:** [September 27, 2010, 8:59pm UTC](https://www.ruby-forum.com/t/ssl-on-rails-3/195661 "2010-09-27T20:59:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/48db29/32.png) [@ntk](https://www.ruby-forum.com/u/ntk)\
**Post date:** [September 27, 2010, 8:59pm UTC](https://www.ruby-forum.com/t/ssl-on-rails-3/195661/1 "2010-09-27T20:59:51Z")

</div>

Been looking at different pages on google about using SSL on Rails 3. I  
have  
been using ssl\_requirement prior to Rails 3. Wondering if  
ssl\_requirement  
will still work on Rails 3 (anyone used)? Or whether to go the way of  
the  
new router. If so, is there a way to tell it to just make everything  
ssl?

I have tried this code in my router but at lest in dev mode does not  
seem to  
work. Curious what people are doing in actuality. I like ssl\_requirement  
as  
it made things pretty transparent.

MyApp::Application.routes.draw do

class SslConstraint  
def self.matches?(request)  
request.ssl?  
end  
end

scope :constraints =\> SslConstraint do  
resources :user\_sessions  
resources :users  
resources :practices  
resources :password\_resets  
resources :home  
# Other SSL routes go in here  
end  
end

AND alternatively:

resources :users, :constraints =\> { :protocol =\> “https” }
