The Gitlab URL is redirecting to older URL

The Gitlab URL is redirecting to older URL after restoring PostgreSQL data in Server in a embedded Gitaly Setup. I tried to restore the PostgreSQL data as I was not able to access the projects I backed up.

Hi,

I would run reconfigure:

gitlab-ctl reconfigure

since a restore does not take care of replacing values changed in gitlab.rb like external_url. A reconfigure after restore would do that.

Actually the gitlab.rb file is pointing to the correct URL but the new server is redirecting to the URL whose database i have restored

Yes, because the gitlab.rb has it applied, the database after restore has the old one. So, to update it in the database you have to run the command I gave you: reconfigure

You can also see the steps in the restore docs: Restore GitLab | GitLab

sudo gitlab-backup restore BACKUP=11493107454_2018_04_25_10.6.4-ce

and then the next steps you see are:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

which are most likely the steps that you didn’t do after restore to fix it and that is why your URL is messed up.

I have done reconfigure and restore and still it redirects to the old url

Please explain more of your configuration, how Gitlab is installed, please provide full config of gitlab.rb so that we can see how it is configured. Also explain if you are using external nginx/apache and show this configuration as well.

On a standard omnibus installation, with correctly configured gitlab.rb this doesn’t happen. I’ve restored Gitlab many times, and it has never done this and I have changed URL without any issues at all. This means you have an issue with your configuration that is causing this to happen. Or maybe even DNS or host configuration is not configured correctly and causing redirects.

So the more detail you can give showing your configuration, the more it will help in solving it.

the word count does not allow me to add gitlab.rb file here.

Use a service like pastebin: https://pastebin.com/

I have added the gitlab.rb. Thanks for pastebin solution @iwalker

What is the URL that you use in your web browser? And what URL does it redirect to? We need to know that as well.

I type to the URL given in the gitlab.rb but it points to some other url

You are going to have to provide a lot more detail than you are doing. I asked for specific URL’s what was typed and what did it change to?

Also using IP address in external_url or registry_url is not a good idea. You should be using an actual hostname/domain name, like gitlab.mydomain.com etc.

Anyway, until you start providing a lot more information, nobody is going to be able to help. You also failed to explain in more detail how your Gitlab is installed when I asked about it since a lot of that can also be relevant.

I got the URL back by removing the entry for home_page_url in the PostgreSQL DB and updating it to the new URL. Now the Gitlab URL works but the login username and password boxes are not showing up.

I know that saml SSO login was enabled on the last setup which i backed up and restored, but i dont know what fields to change in the PGSQL database to get the username and password boxes ie. the correct login page. I would also say that I have gitlab.rb is according to the new setup. Its the DB only which is old one.

Thanks

Similar to how you edited the home_page_url edit password_authentication_enabled_for_web

Run:

sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

Execute the following in the DB:

select password_authentication_enabled_for_web from application_settings;
update application_settings set password_authentication_enabled_for_web='t' where password_authentication_enabled_for_web='f'
select password_authentication_enabled_for_web from application_settings;

Exit the DB and perform reconfigure, restart.