force_ssl

SSLを強制(force_ssl)

適応バージョン

  • 1.0.0
  • 1.1.0
  • 1.1.1
  • 1.1.6
  • 1.2.0
  • 1.2.6
  • 2.0.0
  • 2.0.1
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.2
  • 2.3.8
  • 3.0.0
  • 3.0.5
  • 3.0.7
  • 3.0.9
  • 3.1.0
  • 3.2.3
  • 3.2.8
  • 3.2.13
  • 4.0.0
  • 4.1.0
  • 4.2.1

説明

特定のコントローラをHTTPSリクエストに強制する

使い方

force_ssl([オプション])

オプション

オプション説明
hostRedirect to a different host name
subdomainRedirect to a different subdomain
domainRedirect to a different domain
portRedirect to a non-standard port
pathRedirect to a different path
statusRedirect with a custom status (default is 301 Moved Permanently)
flashSet a flash message when redirecting
alertSet an alert message when redirecting
noticeSet a notice message when redirecting
onlyThe callback should be run only for this action
exceptThe callback should be run for all actions except this action
if symbol naming an instance method or a proc; the callback
unlessA symbol naming an instance method or a proc; the callback

class AccountsController < ApplicationController
  force_ssl if: :ssl_configured?

  def ssl_configured?
    !Rails.env.development?
  end
end

ソースコード

ソースコード検索