Rails3里SSL使用 ... no reply
by Latest from ChinaonRails
at 2010-10-09 08:56:10
original http://feedproxy.google.com/~r/LatestFromChinaonrails/~3/T6ezE_TsJpg/4520.html
http://themomorohoax.com/2010/10/08/using-ssl-in-rails-3
文章总结出几种实施的方式
1.Forcing SSL in a scope
2.An SSL constraints class
3.Rack SSL middleware
同时还有个插件ssl_requirement
http://github.com/bartt/ssl_requirement
可以这么用
class ApplicationController < ActionController::Base
include SslRequirement
end
include SslRequirement
end
不过希望未来能
resources :secrets, :ssl => {:only => [:new, :create]}
resources :secrets, :ssl => :required
resources :secrets, :ssl => :allowed
scope :constraints => [{:protocol => :ssl, :redirect => true}] do
resources :secrets
end
resources :secrets, :ssl => :required
resources :secrets, :ssl => :allowed
scope :constraints => [{:protocol => :ssl, :redirect => true}] do
resources :secrets
end