Apache reverse proxy: Not all url's correct

Summary

I'm running GitLab behind an Apache reversed proxy. Gitlab is running on port 9091 and Apache forwards all traffic from https://mydomain.com to 127.0.0.1:9091

Steps to reproduce

In /etc/gitlab/gitlab.rb: Set external_url 'http://mydomain.com:9091' Set unicorn['listen'] = '127.0.0.1' (not sure if relevant, but i've set this option).

In /var/opt/gitlab/gitlab-rails/etc/gitlab.yml

Set

host: mydomain.com
port: 443
https: true

And restart with gitlab-ctl restart

What is the current bug behavior?

I can perform any action i want succesfully, but some generated links still point to http://mydomain.com:9091

Some of those links are:

  • All the links under the "Projects" menu in the top navbar
  • "Create new merge request in " from the groups page.

For me, this isn't a breaking issue because i don't use those links very often. But for other users it might be confusing, because port 9091 isn't opened up to the world, so users will get an "unable to connect" error. Altering /var/opt/gitlab/gitlab-rails/etc/gitlab.yml with the right port and restarting doesn't help either.

What is the expected correct behavior?

All generated links should point to https://mydomain.com

Results of GitLab environment info

System information
System:
Current User:   git
Using RVM:      no
Ruby Version:   2.3.5p376
Gem Version:    2.6.13
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: 10.0.1 Revision: 2417795 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://mydomain.com HTTP Clone URL: https://mydomain.com/some-group/some-project.git SSH Clone URL: git@mydomain.com:some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 5.9.0 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

Checking GitLab Shell ...

GitLab Shell version >= 5.9.0 ? ... OK (5.9.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 5/2 ... ok 3/3 ... 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 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: ... 3/1 ... yes 5/2 ... yes 3/3 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... Exception: undefined method run_command' for SystemCheck::App::RubyVersionCheck:Class Did you mean? run_commands Git version >= 2.7.3 ? ... Exception: undefined method run_command' for SystemCheck::App::GitVersionCheck:Class Did you mean? run_commands Git user has default SSH configuration? ... yes Active users: ... 2

Checking GitLab ... Finished

Possible fixes

I've read more issues with urls, when using reverse proxies. It would be nice if we could define a variable that GitLab would use to generate urls, next to the url it's listening on because many people are editing the /var/opt/gitlab/gitlab-rails/etc/gitlab.yml file. And those changes are lost after a reconfigure.

Edited Oct 05, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading