Skip to content

When namespace_in_path is enabled and auth_redirect_uri is manually updated to non-projects url, auth flow fails

Summary

When namespace_in_path is enabled and auth_redirect_uri is manually updated to a non-projects URL, the authentication flow fails. The user gets redirected to GitLab and back to Pages. However, Pages then issues a redirect back to itself, adding a '/' at the end. This results in a situation of TOO_MANY_REDIRECTS, where every redirect adds a new '/' to the end of the request.

Build version: v16.10.0

Steps to reproduce

Configuration is given here: #434372 (comment 1834860095)

Example Project

What is the current bug behavior?

The user gets redirected to GitLab and back to Pages. However, Pages then issues a redirect back to itself, adding a '/' at the end. This results in a situation of TOO_MANY_REDIRECTS, where every redirect adds a new '/' to the end of the request.

What is the expected correct behavior?

The authentication flow should complete, allowing the user to access the pages after entering their credentials.

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