Removing all domains does not reset primary domain
Summary
There is a Primary domain dropdown menu under Deploy > Pages > Settings that will show all possible domains that can be set as a primary. However, this menu is only shown if there are domains in the Domains list. If you remove all Domains , the dropdown menu will disappear but will not reset what is considered the primary domain. When you use the API, you can still see that the primary domain is set. In my example, I had already removed http://new-test-cbjr-domain.com/ as a domain but it was still set as the primary despite not being able to change it further.
{
url: "https://test-pages-aba2e8.gitlab.io",
deployments: [
{
created_at: "2025-01-23T16:51:09.482Z",
url: "https://test-pages-aba2e8.gitlab.io",
path_prefix: null,
root_directory: null
}
],
is_unique_domain_enabled: true,
force_https: false,
pages_primary_domain: "http://new-test-cbjr-domain.com"
}
Steps to reproduce
- Initialize a generic
Pages/Plain HTMLproject from template - Run a pipeline to deploy pages
- Go to Deploy > Pages > New Domain
- Enter in any fake domain and ignore the SSL requirements. Save Changes.
- Select the new fake domain under the
Primary domaindropdown. Save Changes. - Delete the newly created fake domain under
Domains - Use the API endpoint
https://gitlab.com/api/v4/projects/PROJECT_ID/pagesto check thepages_primary_domain. It should be set to the one you recently deleted. - Notice that you are unable to change the primary domain any longer. Use the workaround to reset it.
Example Project
What is the current bug behavior?
A user is unable to clearly reset the primary domain if the domain has been removed.
What is the expected correct behavior?
Removing all domains should reset the primary back to the generated gitlab.io address or the dropdown menu should persist.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`) (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`) (we will only investigate if the tests are passing)
Possible fixes
Workaround
- Add another fake domain under
New Domain - Save Changes and this should take you back to the main pages settings
- Click the dropdown for
Primary domainand select thegitlab.ioURL and Save Changes - Go back to
Domainsand then remove the fake domain you created temporarily.