diff options
author | Phil Hughes <me@iamphill.com> | 2016-07-26 11:10:27 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-07-26 11:10:27 +0100 |
commit | 2f5ee5ed202c3ba45d123616ded9a715380f5411 (patch) | |
tree | 872b46f6da752bf0bfc0f97b05bb03dc6eff3e09 /config/initializers/trusted_proxies.rb | |
parent | 35ce7aae019462b5b39b89a4f900a0c100ff71bd (diff) | |
parent | 2e6a3b697c665006de87acc5777e6e332dee804a (diff) | |
download | gitlab-ce-2f5ee5ed202c3ba45d123616ded9a715380f5411.tar.gz |
Merge branch 'master' into diff-line-comment-vuejs
Diffstat (limited to 'config/initializers/trusted_proxies.rb')
-rw-r--r-- | config/initializers/trusted_proxies.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/config/initializers/trusted_proxies.rb b/config/initializers/trusted_proxies.rb index df4a933e22f..30770b71e24 100644 --- a/config/initializers/trusted_proxies.rb +++ b/config/initializers/trusted_proxies.rb @@ -11,6 +11,12 @@ module Rack end end +gitlab_trusted_proxies = Array(Gitlab.config.gitlab.trusted_proxies).map do |proxy| + begin + IPAddr.new(proxy) + rescue IPAddr::InvalidAddressError + end +end.compact + Rails.application.config.action_dispatch.trusted_proxies = ( - [ '127.0.0.1', '::1' ] + Array(Gitlab.config.gitlab.trusted_proxies) -).map { |proxy| IPAddr.new(proxy) } + [ '127.0.0.1', '::1' ] + gitlab_trusted_proxies) |