Skip to content

Fix gitlab-shell not handling relative URLs over UNIX sockets

Stan Hu requested to merge sh-fix-unix-relative-url-access into master

From omnibus-gitlab!4498 (comment 397401883), if you specify a relative path such as:

external_url 'http://gitlab.example.com/gitlab'

gitlab-shell doesn't have a way to pass the /gitlab to the host. For example, let's say we have:

gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsocket"

If we have /gitlab as the relative path, how do we specify what is the UNIX socket path and what is the relative path? If we specify:

gitlab_url: "http+unix:///var/opt/gitlab/gitlab-workhorse.socket/gitlab

This is ambiguous. Is the socket in /var/opt/gitlab/gitlab-workhorse.socket/gitlab or in /var/opt/gitlab/gitlab-workhorse.socket?

To fix this, this merge request adds an optional gitlab_relative_url_root config parameter:

gitlab_url: "http+unix://%2Fvar%2Fopt%2Fgitlab%2Fgitlab-workhorse%2Fsocket"
gitlab_relative_url_root: /gitlab

This is only used with UNIX domain sockets to disambiguate the socket and base URL path. If gitlab_url uses http:// or https://, then gitlab_relative_url_root is ignored.

Relates to #476 (closed)

Edited by Stan Hu

Merge request reports