diff options
author | José Valim <jose.valim@gmail.com> | 2011-10-09 02:52:42 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-10-09 02:52:42 -0700 |
commit | 2ed66feae0e04c5ab5445fe3a9d7b182b10f6f1a (patch) | |
tree | c94e6ffd565011e982a0ce1dafe5f2aa5c6168be /actionpack/lib | |
parent | 501e5b0d7ff995070e66d4322ed03bd882639258 (diff) | |
parent | d68f27e9b184a8e7e4ce71db11874a6b36ea1edc (diff) | |
download | rails-2ed66feae0e04c5ab5445fe3a9d7b182b10f6f1a.tar.gz rails-2ed66feae0e04c5ab5445fe3a9d7b182b10f6f1a.tar.bz2 rails-2ed66feae0e04c5ab5445fe3a9d7b182b10f6f1a.zip |
Merge pull request #3262 from subdigital/master
Add optional host option to force_ssl
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/force_ssl.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/force_ssl.rb b/actionpack/lib/action_controller/metal/force_ssl.rb index ed693c5967..0fd42f9d8a 100644 --- a/actionpack/lib/action_controller/metal/force_ssl.rb +++ b/actionpack/lib/action_controller/metal/force_ssl.rb @@ -24,12 +24,15 @@ module ActionController # * <tt>only</tt> - The callback should be run only for this action # * <tt>except<tt> - The callback should be run for all actions except this action def force_ssl(options = {}) + host = options.delete(:host) before_filter(options) do if !request.ssl? && !Rails.env.development? - redirect_to :protocol => 'https://', :status => :moved_permanently + redirect_options = {:protocol => 'https://', :status => :moved_permanently} + redirect_options.merge!(:host => host) if host + redirect_to redirect_options end end end end end -end
\ No newline at end of file +end |