Module: ActionController::ForceSSL::ClassMethods
- Defined in:
- actionpack/lib/action_controller/metal/force_ssl.rb
Instance Method Summary collapse
-
#force_ssl(options = {}) ⇒ Object
Force the request to this particular controller or specified actions to be under HTTPS protocol.
Instance Method Details
#force_ssl(options = {}) ⇒ Object
Force the request to this particular controller or specified actions to be under HTTPS protocol.
Note that this method will not be effective on development environment.
Options
-
only
- The callback should be run only for this action -
<tt>except<tt> - The callback should be run for all actions except this action
26 27 28 29 30 31 32 33 34 35 36 |
# File 'actionpack/lib/action_controller/metal/force_ssl.rb', line 26 def force_ssl( = {}) host = .delete(:host) before_filter() do if !request.ssl? && !Rails.env.development? = {:protocol => 'https://', :status => :moved_permanently} .merge!(:host => host) if host .merge!(:params => request.query_parameters) redirect_to end end end |