GitLab Pages API returns lowercase URLs causing redirect loops when 'Use unique domain' is disabled

Summary

When “Use unique domain” is disabled in GitLab Pages settings, the GitLab Pages API (GET /projects/:id/pages) returns URLs with incorrect case sensitivity, resulting in endless redirect loops. This issue does not occur when “Use unique domain” is enabled, suggesting the bug is specific to the group-based domain URL structure.

Steps to reproduce

  1. Create a subgroup and project:
  • Create a subgroup (e.g., “test”) in your group
  • Create a new project with mixed case (e.g., “MyTestProject”) in the subgroup
  • Project path should be: toplevelgroup/test/MyTestProject
  1. Set up GitLab Pages
  2. Configure Pages settings:
  • Go to Settings → Pages
  • Ensure "Use unique domain" is disabled
  • Save changes
  1. Click on the link under the Deployments (e.g., https://indiraca_premium_group.gitlab.io/test/mytestproject)

Additional steps using API

  1. Get project information via API:
  • Get group projects
curl --header "PRIVATE-TOKEN: <your_token>" \
"https://gitlab.com/api/v4/groups/${GROUP_ID}/projects"
  • Get pages info using project ID from previous response
"https://gitlab.com/api/v4/projects/${PROJECT_ID}/pages"
  1. Test URLs:

Example Project

Project path: indiraca_premium_group/test/MyTestProject Project ID: 66144801

What is the current bug behavior?

With "Use unique domain" disabled:

The Pages API returns lowercase URL: https://indiraca_premium_group.gitlab.io/test/mytestproject Accessing this URL results in an endless redirect loop

With "Use unique domain" enabled:

The Pages API returns URL: https://mytestproject-084e2b.gitlab.io/ This URL works correctly

What is the expected correct behavior?

When "Use unique domain" is disabled, the Pages API should return correctly cased URLs matching the project name Example: https://indiraca_premium_group.gitlab.io/test/MyTestProject The returned URL should work without redirect loops regardless of domain settings

Relevant logs and/or screenshots

Use_unique_domain_enabled

Use_Unique_domain_disabled

Redirecting_loop

Output of checks

This bug happens on GitLab.com

/label reproduced on GitLab.com

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