]> cat aescling's git repositories - mastodon.git/commitdiff
Allow to specify trusted proxies through env
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 22 Jan 2017 19:35:49 +0000 (20:35 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 22 Jan 2017 19:35:49 +0000 (20:35 +0100)
config/environments/production.rb

index 1572eaf6cfc89c65ff9f1af7806611dce9d2a35d..d2dfa4274498465fad7cd434b0b18e2d43f719bc 100644 (file)
@@ -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