Sign out link broken on 404 page
Summary
For different organisations, I use different GitLab.com accounts. So I have to switch between the two accounts regularly. For the past few months, when I was logged in with one account and accessed a project from the other account, I got an HTTP 404 "Page Not Found" error with a link at the bottom that says "Sign out and sign in with a different account".
This worked fine for a while, but recently, I can't exactly tell when it started, the link "Sign out and sign in with a different account" no longer works - it produces another HTTP 404 "Page Not Found" error after a HTTP 301 permanent redirect.
I can only sign out when I go to "Home" and then click on my user icon, then select "Sign out". This sign out link still works fine.
Steps to reproduce
- Log into GitLab
- Access a project that you cannot access with your account (or find any other 404 page, e.g. https://gitlab.com/users/sign_out)
- Click on "Sign out and sign in with a different account" on the HTTP 404 page
- You will find yourself on another 404 page with the same issue (e.g. https://gitlab.com/sign_out)
Example Project
https://gitlab.com/users/sign_out
(But not https://gitlab.com/404.html!)
What is the current bug behavior?
The link leads to a 404 page instead of signing the current user out and presenting the user with a form to log in again.
What is the expected correct behavior?
The link should sign the user out and then present the GitLab login page (this worked until not too long ago).
Relevant logs and/or screenshots
HTTP redirect (via Chrome Dev Tools, "Network" tab):
Request URL: https://gitlab.com/users/sign_out
Request Method: GET
Status Code: 301 Moved Permanently
Location: https://gitlab.com/sign_out
Redirect results in HTTP 404 error (via Chrome Dev Tools, "Network" tab):
Request URL: https://gitlab.com/sign_out
Request Method: GET
Status Code: 404 Not Found
Broken link on https://gitlab.com/sign_out
<a rel="nofollow" data-method="post" href="/users/sign_out">Sign out and sign in with a different account</a>
%nav
%ul.error-nav
%li
= link_to s_('Nav|Home'), root_path
%li
- if current_user
= link_to s_('Nav|Sign out and sign in with a different account'), destroy_user_session_path, method: :post
Working link on GitLab.com homepage:
<a class="sign-out-link" data-qa-selector="sign_out_link" rel="nofollow" data-method="post" href="/users/sign_out">Sign out</a>
- if current_user_menu?(:sign_out)
%li.divider
%li
= link_to _("Sign out"), destroy_user_session_path, method: :post, class: "sign-out-link", data: { qa_selector: 'sign_out_link' }
Similar issues
I found some issues that might be related to this bug or at least potentially also affected by this bug:
- 404 page should give option to log in (#19731) - this issue could probably be closed, if the link is working again.
- Link to create merge request gives 404 if not logged in (#23097)
- Merge request link displays as 404 when not logged in (#31202)
Output of checks
This bug happens on GitLab.com.
I'm using "GitLab Next", current version 12.7.0-pre (revision: 277d8e90) according to https://gitlab.com/api/v4/version
Results of GitLab environment info
I can't provide environment info for GitLab.com.
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
I can't provide application check for GitLab.com.
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
First, the link that points to /users/sign_out
should be changed to /sign_out
to avoid the HTTP 301 permanent redirect. But that would only remove the 301, not the actual bug.