浏览代码

Move force_ssl check to production config (#2165)

The force_ssl method from controllers does not add all of the options that the
sitewide configuration in a config block does. For example, HSTS enforcement is
not added by the controller method, but is added by this style.
master
Matt Jankowski 7 年前
committed by Eugen
父节点
当前提交
ee82d8a876
共有 2 个文件被更改,包括 1 次插入2 次删除
  1. +0
    -2
      app/controllers/application_controller.rb
  2. +1
    -0
      config/environments/production.rb

+ 0
- 2
app/controllers/application_controller.rb 查看文件

@@ -5,8 +5,6 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

force_ssl if: "Rails.env.production? && ENV['LOCAL_HTTPS'] == 'true'"

include Localized

helper_method :current_account


+ 1
- 0
config/environments/production.rb 查看文件

@@ -108,6 +108,7 @@ Rails.application.configure do

config.action_mailer.delivery_method = ENV.fetch('SMTP_DELIVERY_METHOD', 'smtp').to_sym

config.force_ssl = (ENV['LOCAL_HTTPS'] == 'true')

config.react.variant = :production



正在加载...
取消
保存