Issue Links routing with absolute URLs instead of relative

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

On a local GitLab instance running on a 2 NIC machine, users who log in from the non-primary network are occasionally routed to the other network on a variety of links. If the user doesn't have access to that network from their machine, they are unable to resolve the link. The issue shows up on any Issue link on the Issues page. A few other links are also broken in the same way when searching for the primary IP address in the web console: the size 16 avatar badge, the author link in the "issuable-info" div, the author-link in the "issuable-status" in the li tag, as well as the link on the comments icon.

Steps to reproduce

  1. Install GitLab on a machine with 2 network interfaces
  2. Navigate to GitLab on your primary network
  3. Create a project
  4. Create an issue
  5. Navigate to GitLab on your secondary network, go to the issues page
  6. Click on the issue and get directed to the issue on the primary network

Example Project

What is the current bug behavior?

Some links redirect incorrectly on a GitLab instance with 2 network interfaces.

What is the expected correct behavior?

Links should not redirect incorrectly, they should be relative hrefs, not absolute.

Relevant logs and/or screenshots

This is an example of an href visible on a different network; currently this is being viewed from 172.16.6.140; clicking this link causes an error for those who don't have access to the 172.16.0.X network.

<a title="Comments" href="http://172.16.0.4/evansemenoff/aurora/-/issues/8#notes" class="gl-link gl-reset-color!"><svg data-testid="comments-icon" role="img" aria-hidden="true" class="gl-icon s16">

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 22.04 Proxy: no Current User: git Using RVM: no Ruby Version: 3.0.6p216 Gem Version: 3.2.33 Bundler Version:2.3.15 Rake Version: 13.0.6 Redis Version: 6.2.11 Sidekiq Version:6.5.7 Go Version: unknown GitLab information Version: 15.11.2-ee Revision: 916d24d1e48 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 13.8 URL: http://172.16.0.4 HTTP Clone URL: http://172.16.0.4/some-group/some-project.git SSH Clone URL: git@172.16.0.4:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.18.0 Repository storages: - default: unix:/var/opt/gitlab/gitaly/gitaly.socket GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell

Results of GitLab application Check

Expand for output related to the GitLab application check


Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 14.18.0 ? ... OK (14.18.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Reply by email is disabled in config/gitlab.yml Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab App ... Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 2/1 ... yes 4/2 ... yes 4/4 ... yes 4/5 ... yes 4/6 ... yes 4/7 ... yes 4/8 ... yes 4/9 ... yes 4/10 ... yes 4/11 ... yes 4/12 ... yes 4/13 ... yes 4/14 ... yes 4/15 ... yes 4/16 ... yes 4/18 ... yes 4/19 ... yes Redis version >= 6.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (3.0.6) Git user has default SSH configuration? ... yes Active users: ... 12 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled) All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled) Checking GitLab App ... Finished Checking GitLab subtasks ... Finished

Possible fixes

I do not know exactly where this reference is generated, but for some reason it's generated as an absolute reference instead of a relative one; all that should be required is to find where this href is generated. I don't know enough about front end to properly track this down, but suspect it's somewhere in, or around /app/views/projects/issues/service_desk/_issue.html.haml.

Edited by 🤖 GitLab Bot 🤖