# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
+ force_ssl if: :https_enabled?
+
include Localized
helper_method :current_account
private
+ def https_enabled?
+ Rails.env.production? && ENV['LOCAL_HTTPS'] == 'true'
+ end
+
def store_current_location
store_location_for(:user, request.url)
end
# Allow to specify public IP of reverse proxy if it's needed
config.action_dispatch.trusted_proxies = [IPAddr.new(ENV['TRUSTED_PROXY_IP'])] unless ENV['TRUSTED_PROXY_IP'].blank?
- # When LOCAL_HTTPS is set, force traffic over SSL
- config.force_ssl = (ENV['LOCAL_HTTPS'] == 'true')
-
- # When ENABLE_HSTS is also set, turn on Strict-Transport-Security
- config.ssl_options = {
- hsts: (ENV['ENABLE_HSTS'] == 'true')
- }
-
# By default, use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym