Reverse Proxying relative URL to root URL results in 404 errorpage

Summary

Using GitLab behind a reverse proxy doesn't seem to work if the configured URL is relative, but the server is running on a root URL

Steps to reproduce

Example:

  ProxyPass        /gitlab https://gitlabserver.internal
  ProxyPassReverse /gitlab https://gitlabserver.internal

What is the current bug behavior?

Browsing to the configured ext_url results in a GitLab 404 error page

What is the expected correct behavior?

Browsing to the configured ext_url results the GitLab login page

Results of GitLab environment info

Expand for output related to GitLab environment info (anonymized)

System information System: Debian 8.9 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 12.0.0 Redis Version: 3.2.5 Git Version: 2.13.5 Sidekiq Version:5.0.4 Go Version: unknown

GitLab information Version: 9.5.1 Revision: c47ae37 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://our.external.webserver/gl HTTP Clone URL: https://our.external.webserver/gl/some-group/some-project.git SSH Clone URL: git@our.external.webserver:some-group/some-project.git Using LDAP: yes Using Omniauth: no

GitLab Shell Version: 5.8.0 Repository storage paths:

  • local: /var/opt/gitlab/git-data/repositories
  • default: /data/gitlab/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 (anonymized and shortened due to confidentiality issues)
Checking GitLab Shell ...

GitLab Shell version >= 5.8.0 ? ... OK (5.8.0) Repo base directory exists? local... yes default... yes Repo storage directories are symlinks? local... no default... no Repo paths owned by git:root, or git:git? local... yes default... yes Repo paths access is drwxrws---? local... yes default... yes hooks directories in repos are links: ... 10/4 ... ok 5/5 ... repository is empty 5/6 ... ok 6/7 ... repository is empty 49/8 ... ok 8/9 ... ok 50/10 ... ok 48/11 ... ok 23/13 ... ok 5/14 ... ok 10/15 ... ok 23/16 ... ok 23/17 ... ok 10/18 ... ok 10/20 ... ok 10/22 ... ok 10/23 ... ok 10/24 ... ok 10/25 ... ok 10/27 ... ok 10/28 ... ok 10/29 ... ok 10/30 ... ok 10/31 ... ok 10/32 ... ok 10/33 ... ok 10/34 ... ok 10/35 ... ok 10/36 ... ok 10/37 ... ok 10/38 ... ok 10/39 ... ok 10/40 ... ok 10/41 ... ok 10/42 ... ok 10/43 ... ok 10/44 ... ok 10/45 ... ok 10/46 ... ok 10/47 ... ok 10/48 ... ok 10/49 ... ok 10/50 ... ok 10/51 ... ok 10/54 ... ok 10/55 ... ok 10/56 ... ok 10/57 ... ok 10/58 ... ok 10/59 ... ok 10/61 ... ok 8/62 ... ok 34/63 ... ok 34/64 ... ok 34/65 ... ok 34/66 ... ok 34/67 ... ok 34/68 ... ok 34/69 ... ok 34/70 ... ok 48/71 ... ok 48/73 ... ok 48/74 ... ok 50/75 ... ok 48/76 ... ok 5/77 ... ok 5/78 ... ok 5/79 ... ok 7/80 ... ok 39/81 ... ok 41/82 ... ok 5/83 ... ok 43/84 ... ok 48/85 ... ok 8/86 ... repository is empty 43/88 ... ok 51/89 ... ok 10/90 ... ok 48/91 ... ok 48/92 ... ok 49/94 ... repository is empty 5/95 ... repository is empty 48/96 ... ok 10/97 ... ok 10/98 ... ok 53/100 ... ok 53/101 ... ok 53/102 ... ok 8/103 ... ok 48/104 ... ok 48/105 ... ok 5/106 ... ok 5/107 ... ok 50/108 ... ok 8/109 ... ok 48/110 ... ok 23/111 ... ok 50/112 ... ok 12/114 ... ok 48/116 ... ok 8/117 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: FAILED. code: 302 gitlab-shell self-check failed Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u git -H editor /opt/gitlab/embedded/service/gitlab-shell/config.yml Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Sidekiq ...

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

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

Server: ldapmain not verifying SSL hostname of LDAPS server 'our.ldapserver:389' LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) [...] 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? ... no Try fixing it: sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} ; sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} ; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. 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: ... 10/4 ... yes 5/5 ... yes 5/6 ... yes 6/7 ... yes 49/8 ... yes 8/9 ... yes 50/10 ... yes 48/11 ... yes 23/13 ... yes 5/14 ... yes 10/15 ... yes 23/16 ... yes 23/17 ... yes 10/18 ... yes 10/20 ... yes 10/22 ... yes 10/23 ... yes 10/24 ... yes 10/25 ... yes 10/27 ... yes 10/28 ... yes 10/29 ... yes 10/30 ... yes 10/31 ... yes 10/32 ... yes 10/33 ... yes 10/34 ... yes 10/35 ... yes 10/36 ... yes 10/37 ... yes 10/38 ... yes 10/39 ... yes 10/40 ... yes 10/41 ... yes 10/42 ... yes 10/43 ... yes 10/44 ... yes 10/45 ... yes 10/46 ... yes 10/47 ... yes 10/48 ... yes 10/49 ... yes 10/50 ... yes 10/51 ... yes 10/54 ... yes 10/55 ... yes 10/56 ... yes 10/57 ... yes 10/58 ... yes 10/59 ... yes 10/61 ... yes 8/62 ... yes 34/63 ... yes 34/64 ... yes 34/65 ... yes 34/66 ... yes 34/67 ... yes 34/68 ... yes 34/69 ... yes 34/70 ... yes 48/71 ... yes 48/73 ... yes 48/74 ... yes 50/75 ... yes 48/76 ... yes 5/77 ... yes 5/78 ... yes 5/79 ... yes 7/80 ... yes 39/81 ... yes 41/82 ... yes 5/83 ... yes 43/84 ... yes 48/85 ... yes 8/86 ... yes 43/88 ... yes 51/89 ... yes 10/90 ... yes 48/91 ... yes 48/92 ... yes 49/94 ... yes 5/95 ... yes 48/96 ... yes 10/97 ... yes 10/98 ... yes 53/100 ... yes 53/101 ... yes 53/102 ... yes 8/103 ... yes 48/104 ... yes 48/105 ... yes 5/106 ... yes 5/107 ... yes 50/108 ... yes 8/109 ... yes 48/110 ... yes 23/111 ... yes 50/112 ... yes 12/114 ... yes 48/116 ... yes 8/117 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.5) Active users: ... 37

Checking GitLab ... Finished