Web IDE error with reverse proxy, relative URL configuration. 404 error.
Summary
I am encountering an issue very much like the one reported 3 years ago in gitlab-foss#45649 (closed), in at least 14.2.x and 14.3.0. I've also found other reports here, at forum.gitlab.com, and in google searches that are similar, but none of the suggested workarounds I've found have helped me. I'm not sure if this is something new, or a regression of the other issues that have turned up in searches.
Possibly related to #332018 (closed)?
Everything else (so far) seems to be working as expected in this relative URL proxied configuration.
Steps to reproduce
My GitLab (omnibus) is running in a docker container with a nginx server running as front-end proxy which handles the SSL connection and puts GitLab into a relative URL, so it is accessible as https://my-server/gitlab/. Other services on the same machine are handled the same way.
The Omnibus config looks like this:
external_url 'https://my-server/gitlab/'
gitlab_rails['gitlab_shell_ssh_port'] = 44
gitlab_rails['lfs_enabled'] = true
nginx['real_ip_trusted_addresses'] = [ '172.100.0.0/24' ]
nginx['real_ip_header'] = 'X-Forwarded-For'
nginx['real_ip_recursive'] = 'on'
nginx['listen_https'] = false
nginx['listen_port'] = 80
The GitLab portion of the configuration in the nginx proxy server looks like this:
location /gitlab/ {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Ssl on;
proxy_buffering off;
proxy_pass http://gitlab/gitlab/;
}
(The "gitlab" hostname above is the name of the container, and so is visible on the internal docker network with that name.)
What is the current bug behavior?
When clicking the Web IDE button in a project the next page displays the error message "Error while loading the project data. Please try again."
What is the expected correct behavior?
The Web IDE should be loaded and function without error.
Relevant logs and/or screenshots
When the error happens I find this in the proxy server's log. Notice the 404:
10.104.59.62 - - [29/Sep/2021:07:53:46 -0700]
"GET /gitlab/api/v4/projects/robind%2Ftest-project HTTP/1.1" 404 25
"https://my-server/gitlab/-/ide/project/robind/test-project/edit/main/-/"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36"
There is also this corresponding 404 entry in the gitlab_access.log:
10.104.59.62 - - [29/Sep/2021:14:53:46 +0000]
"GET /gitlab/api/v4/projects/robind/test-project HTTP/1.1" 404 25
"https://my-server/gitlab/-/ide/project/robind/test-project/edit/main/-/"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" -
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
root@gitlab:/# gitlab-rake gitlab:env:info System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.4p191 Gem Version: 3.1.4 Bundler Version:2.1.4 Rake Version: 13.0.6 Redis Version: 6.0.14 Git Version: 2.33.0. Sidekiq Version:5.2.9 Go Version: unknown GitLab information Version: 14.3.0-ee Revision: dec73e99fdd Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.7 URL: https://my-server/gitlab HTTP Clone URL: https://my-server/gitlab/some-group/some-project.git SSH Clone URL: ssh://git@my-server:44/some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 13.21.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
root@gitlab:/# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.21.0 ? ... OK (13.21.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
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: ... 2/1 ... yes 5/2 ... yes 5/4 ... yes 9/6 ... yes 9/7 ... yes 6/8 ... yes 6/9 ... yes 5/10 ... yes 6/11 ... yes 11/15 ... yes 5/16 ... yes 17/17 ... yes 20/18 ... yes 14/19 ... yes 10/20 ... yes 5/24 ... yes 24/25 ... yes 18/26 ... yes 6/28 ... yes 28/29 ... yes 28/30 ... yes 29/31 ... yes 6/32 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.4) Git version >= 2.31.0 ? ... yes (2.33.0) Git user has default SSH configuration? ... yes Active users: ... 24 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
Unknown.