Unexpected GitLab page URL

461 views Asked by At

I had a Gitlab Pages hosted at https://username.gitlab.io/project/. I deleted and recreated the project (https://gitlab.com/username/project/) to start again with a clean history.

The page url is now https://project-username-longrandomhash.gitlab.io. https://username.gitlab.io/project/ redirects to https://monprojet-username-longrandomhash.gitlab.io.

2

There are 2 answers

0
sytech On BEST ANSWER

Since GitLab 15.11, new projects will have the enable unique domains setting enabled by default. This is a security-related change that helps prevent cookies from being shared between your different Pages sites, helping secure them against attacks that would be prevented by using different domains.

When you re-created your project, it will have been created with this setting enabled. Assuming your project was originally created before the release of GitLab 15.11, that would explain this change. If you wish to disable this feature, you can unselect the 'enable unique domains' feature in the project settings.

0
VonC On

I only see project- mentioned in the GitLab Pages redirects (configuration file named _redirects in the public/ directory of your GitLab Pages site.)

Besides that, the project website URL should be:

  • On GitLab.com, a project site is always available under https://namespace.gitlab.io/project-slug
  • On GitLab.com, a user or group website is available under https://namespace.gitlab.io/

So you need to contact the support to understand where a https://project-... URL comes from.

But next time you want to start over with a clean history, you might want to force push a branch (git push --force), instead of deleting/recreating the repository: you will get less exposed to that kind of URL... fluctuation.