GitLab redirecting to old external URL?

Currently, I have a working GitLab 16.8 instance configured to be accessible via a VPN only. The external_url is set to http://server.vpn:5001/. I am now trying to reconfigure GitLab to be accessible from anywhere through a reverse proxy that also hosts an existing website and terminates SSL. Let’s say I want to set the external URL to https://gitlab.example.com.

I have followed the steps here, but am having problems. When I leave the external_url as http://server.vpn:5001/, I get a 422 “the change you requested was rejected” error when trying to log in via https://gitlab.example.com. From what I understand, this is expected behavior. However:

  • When I change the external_url to https://gitlab.example.com, GitLab is accessible via the domain name, but redirects to https://server.vpn:5001/ (and yes, that https:// is intended - it tries an SSL connection to the old HTTP URL)
  • If I somehow manage to access https://gitlab.example.com without being redirected, I get the same old 422 “the change you requested was rejected” error.

I have also run the commands sudo gitlab-ctl reconfigure and sudo gitlab-ctl restart after reconfiguring, and the issue persists.

The operating system is Ubuntu 22.04 LTS. I’m not entirely sure how I installed the instance anymore as I did this over a year ago, but several sources suggest this is important information. So, concretely, my questions are:

  • Why am I being redirected to the old URL, and how can I prevent this?
  • Is there any indicator that could tell me how the instance was installed?

Thanks in advance!

I was restoring a backup of Production Gitlab in my Test VM, after restoring it kept redirecting to the Production URL although my gitlab.rb was configured with the New URL.

The issue was that the DB entry did not change even after reconfigure, You can try to change it in the DB and do a reconfigure, maybe that works.


sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
 
#Inside the DB run the following
-> home_page_url: select home_page_url from application_settings;
-> update application_settings set home_page_url='NEW_URL' where home_page_url='OLD_URL';