Module: ActionController::ForceSSL::ClassMethods

Defined in:
actionpack/lib/action_controller/metal/force_ssl.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#force_ssl(options = {}) ⇒ Object


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'actionpack/lib/action_controller/metal/force_ssl.rb', line 19

def force_ssl(options = {})
  ActiveSupport::Deprecation.warn("Controller-level `force_ssl` is deprecated and will be removed from\nRails 6.1. Please enable `config.force_ssl` in your environment\nconfiguration to enable the ActionDispatch::SSL middleware to more\nfully enforce that your application communicate over HTTPS. If needed,\nyou can use `config.ssl_options` to exempt matching endpoints from\nbeing redirected to HTTPS.\n".squish)

  action_options = options.slice(*ACTION_OPTIONS)
  redirect_options = options.except(*ACTION_OPTIONS)
  before_action(action_options) do
    force_ssl_redirect(redirect_options)
  end
end