Wrong URL link when behind reverse proxy

Summary

When you setup gitlab server that is behind reverse proxy, the link in admin area->runners and groups settings->CI/CD->runners is showing the IP address of reverse proxy server instead of resolved hostname.

Steps to reproduce

  1. create reverse proxy server
  2. create gitlab instance
  3. configure gitlab.rb file with following configuration
external_url 'http://yourReverseProxyAddress/gitlab/'
nginx['enable'] = true
nginx['proxy_set_headers'] = {
  "Host" => "$http_host",
  "X-Real-IP" => "$remote_addr",
  "X-Forwarded-For" => "$proxy_add_x_forwarded_for",
  "X-Forwarded-Proto" => "https",
  "X-Forwarded-Ssl" => "on",
  "Upgrade" => "$http_upgrade",
  "Connection" => "$connection_upgrade"
}
nginx['real_ip_trusted_addresses'] = [ '172.27.18.3' ]
nginx['real_ip_header'] = 'X-Real-IP'
nginx['real_ip_recursive'] = 'on'
  1. navigate to "admin area->runners"
  2. see the link of runner in "Set up a shared Runner manually" window

What is the current bug behavior?

Wrong URL is used in runner setup description

What is the expected correct behavior?

When gitlab is behind reverse proxy, resolved hostname should be displayed and used as URL

Relevant logs and/or screenshots

image

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:         Debian 9.5
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.4.5p335
Gem Version:    2.7.6
Bundler Version:1.16.6
Rake Version:   12.3.1
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.1
Go Version:     unknown

GitLab information Version: 11.5.0-ee Revision: cb71fca Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.8 URL: https://asic.sk-kosice.t-systems.sk/gitlab HTTP Clone URL: https://asic.sk-kosice.t-systems.sk/gitlab/some-group/some-project.git SSH Clone URL: git@asic.sk-kosice.t-systems.sk:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 8.4.1 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab Shell ...

GitLab Shell version >= 8.4.1 ? ... OK (8.4.1) hooks directories in repos are links: ... 16/3 ... ok 16/4 ... ok 19/7 ... ok 20/8 ... ok 3/10 ... ok 21/11 ... ok 19/12 ... ok 3/13 ... ok 29/14 ... ok 31/17 ... ok 10/18 ... ok 32/20 ... ok 32/21 ... ok 32/22 ... ok 33/23 ... ok 3/24 ... ok 3/25 ... ok 3/26 ... ok 20/27 ... ok 4/28 ... ok 26/30 ... ok 26/31 ... ok 26/32 ... ok 3/33 ... ok 10/37 ... ok 34/39 ... repository is empty 36/41 ... ok 36/42 ... ok 20/43 ... repository is empty 3/44 ... ok 42/45 ... ok 55/46 ... ok 48/47 ... ok 57/48 ... ok 3/49 ... ok 55/50 ... ok 48/51 ... ok 4/52 ... ok 57/55 ... ok 55/56 ... ok 66/57 ... ok 71/58 ... ok 69/59 ... ok 69/60 ... ok 56/62 ... ok 71/64 ... ok 61/65 ... ok 55/68 ... ok 63/69 ... ok 71/70 ... ok 58/71 ... repository is empty 69/72 ... ok 69/73 ... ok 26/74 ... repository is empty 26/75 ... ok 26/76 ... repository is empty 26/77 ... repository is empty 59/78 ... ok 71/80 ... ok 26/81 ... repository is empty 56/82 ... ok 71/83 ... ok 71/84 ... ok 59/85 ... ok 58/86 ... ok 56/87 ... ok 71/88 ... ok 71/89 ... ok 63/90 ... ok 18/94 ... repository is empty 3/95 ... ok 71/96 ... ok 61/97 ... ok 61/100 ... ok 53/101 ... ok 69/102 ... ok 55/103 ... ok 3/104 ... ok 71/105 ... ok 3/106 ... ok 3/108 ... ok 56/109 ... ok 3/111 ... ok 69/112 ... ok 90/113 ... ok 90/114 ... ok 94/116 ... ok 94/117 ... ok 94/118 ... ok 3/120 ... ok 94/121 ... ok 104/122 ... ok 104/123 ... ok 94/124 ... ok 105/125 ... ok 94/126 ... ok 18/127 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 16/3 ... yes 16/4 ... yes 19/7 ... yes 20/8 ... yes 3/10 ... yes 21/11 ... yes 19/12 ... yes 3/13 ... yes 29/14 ... yes 31/17 ... yes 10/18 ... yes 32/20 ... yes 32/21 ... yes 32/22 ... yes 33/23 ... yes 3/24 ... yes 3/25 ... yes 3/26 ... yes 20/27 ... yes 4/28 ... yes 26/30 ... yes 26/31 ... yes 26/32 ... yes 3/33 ... yes 10/37 ... yes 34/39 ... yes 36/41 ... yes 36/42 ... yes 20/43 ... yes 3/44 ... yes 42/45 ... yes 55/46 ... yes 48/47 ... yes 57/48 ... yes 3/49 ... yes 55/50 ... yes 48/51 ... yes 4/52 ... yes 57/55 ... yes 55/56 ... yes 66/57 ... yes 71/58 ... yes 69/59 ... yes 69/60 ... yes 56/62 ... yes 71/64 ... yes 61/65 ... yes 55/68 ... yes 63/69 ... yes 71/70 ... yes 58/71 ... yes 69/72 ... yes 69/73 ... yes 26/74 ... yes 26/75 ... yes 26/76 ... yes 26/77 ... yes 59/78 ... yes 71/80 ... yes 26/81 ... yes 56/82 ... yes 71/83 ... yes 71/84 ... yes 59/85 ... yes 58/86 ... yes 56/87 ... yes 71/88 ... yes 71/89 ... yes 63/90 ... yes 18/94 ... yes 3/95 ... yes 71/96 ... yes 61/97 ... yes 61/100 ... yes 53/101 ... yes 69/102 ... yes 55/103 ... yes 3/104 ... yes 71/105 ... yes 3/106 ... yes 3/108 ... yes 56/109 ... yes 3/111 ... yes 69/112 ... yes 90/113 ... yes 90/114 ... yes 94/116 ... yes 94/117 ... yes 94/118 ... yes 3/120 ... yes 94/121 ... yes 104/122 ... yes 104/123 ... yes 94/124 ... yes 105/125 ... yes 94/126 ... yes 18/127 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.5) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 81 Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)

Checking GitLab ... Finished

Edited Nov 26, 2018 by Lopfest
Assignee Loading
Time tracking Loading