about summary refs log tree commit diff
path: root/config/environments
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-22 20:35:49 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-22 20:35:49 +0100
commit67befe546342c58f1a16bdb08b6a2ef438e83d57 (patch)
tree0b7890735be82283ad52ae614eda184d90f66bc1 /config/environments
parentc66718afff891ee366fdd744830f67e06fc1191c (diff)
Allow to specify trusted proxies through env
Diffstat (limited to 'config/environments')
-rw-r--r--config/environments/production.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 1572eaf6c..d2dfa4274 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -32,6 +32,9 @@ Rails.application.configure do
   # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
   config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
 
+  # 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?
+
   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
   config.force_ssl = false