Links in a self-hosted Gitlab server that use the external_url hostname redirect to the login page after an upgrade

After upgrading from Gitlab Omnibus 13.something to Omnibus 15.1 using the recommended upgrade path, certain links in Gitlab will redirect to the login page. The links that redirect use the external_url hostname, while links that use the actual hostname of the server work correctly. DNS is set such that the external_url host is a CNAME record pointing to the real machine hostname.

For example, if I click any issue in the Issues list for a project, I will be redirected to the login page. If I click on the same issue in my dashboard, I will be sent to the actual issue page. What would cause some links to use the external_url and others to use the machine hostname?

Prior to the upgrade, this redirection did not occur.