summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Azzopardi <steveazz@outlook.com>2019-01-24 08:55:22 +0100
committerSteve Azzopardi <steveazz@outlook.com>2019-01-24 09:03:14 +0100
commitcb67423d48f6e5e78c7ecd9196b93edf7666ba0c (patch)
tree8be43b9f851a1baebf95b9fd05c809409892ae91 /lib
parent97aa25ba8b87797da268c5b42179df3799347847 (diff)
downloadgitlab-ce-cb67423d48f6e5e78c7ecd9196b93edf7666ba0c.tar.gz
Get remote address for runner
Check if `X-Forwarded-For` is set before getting the IP of the request, with this the real IP address of the runner is shown if it's behind a proxy. closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53676
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers/runner.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/helpers/runner.rb b/lib/api/helpers/runner.rb
index 45d0343bc89..16df8e830e1 100644
--- a/lib/api/helpers/runner.rb
+++ b/lib/api/helpers/runner.rb
@@ -26,7 +26,7 @@ module API
end
def get_runner_ip
- { ip_address: request.ip }
+ { ip_address: request.env["HTTP_X_FORWARDED_FOR"] || request.ip }
end
def current_runner