external_url not used everywhere it should.
Installed Packages
Name : gitlab-ce
Arch : x86_64
Version : 8.15.1
Release : ce.0.el6
Size : 780 M
Repo : installed
From repo : /gitlab-ce-8.15.1-ce.0.el6.x86_64
I was first going to create an issue in the gitlab-ce project, but as I dived into it, I've found a fix that, IMHO, should be made in omnibus.
The problem is that, in our case, gitlab used different base urls when installed and accessed through 2-hops reverse proxying (company security policies).
In my case, users access gitlab through http://git.example.com
which is a RP to http://git.sd.example.com
which is a httpd RP to omnibus installed package at localhost (with nginx disabled, I've used a config that works fine, found in an issue answer).
The problem was that the base path (shown in new/edit project) for all projects was http://git.sd.example.com
instead of http://git.example.com
and some requests failed (due to Same Origin Policy) because they were directed at http://git.sd.example.com
.
After investigation, it was clear that the rails routing helpers were the source of the issue, and I've found out that it is possible to set the host for assets and routes helpers so that it will always be git.example.com
as I needed it to be.
The fix consisted in adding those two lines to gitlab's config/environments/production.rb
:
config.action_controller.default_url_options = { host: 'git.example.com' }
config.action_controller.asset_host = "//git.example.com"
So I think it would be nice to set these two values to external_url
's host when a reconfigure
is triggered.
I've seen numerous issues with bad base urls, and no obvious solutions, I hope this might be it.