Skip to content

WIP: Multiple values in array for external_url (feature proposal)

What

This is a two-in-one feature proposal and merge request. As of commit 6c2ce211, it is a work in progress and not ready to be considered for merge.

The proposed feature is to allow users to have their Gitlab instance accessible over multiple domains. Currently, Gitlab will redirect a visitor to the external_url if the application is accessed via a URI that resolves to the server other than the one specified.

Why

I can think of at least three use-cases where this would be helpful:

  • If a company or organization has multiple localized TLDs but wants centralized development and access to Gitlab. E.g., gitlab.com and gitlab.jp.

  • If an organization with a single Gitlab server has any side ventures with their own domains but they want that venture's git projects accessible via that domain. For example, box.es has a side venture at tradeshow.net and want to access Gitlab over both git.box.es and git.tradeshow.net but only want or have a single Gitlab instance. This feature will be especially useful for companies who start ventures as simple projects or groups but suspect that as the venture grows it will eventually make sense to have its own Gitlab server. With this feature, they can use the domain of the venture both to access the web application and to set the remote for their git repositories. That way when they do eventually create a separate server they just have to migrate the projects and won't need to worry about changing their remote urls.

  • If a sole proprietor or small development firm can only afford a single Gitlab server but wants to have it accessible over their company domain as well as their personal domains.

How

The current implementation allows users to pass in an array to external_url, for example:

external_url ['git.mydomain1.com', 'git.mydomain2.com']

Pros to this approach:

  • Logical for the end-user
  • Can allow for more robust integration with the Gitlab rails app, etc.

Cons to this approach:

  • Original/default/most important domain may be ambiguous. Currently, the first item in the array is assumed to be most important.
  • The last "pro" listed might also be a con. Although using external_url here makes sense if some features in Gitlab-rails were implemented to leverage this, having an array passed into external_url may cause fragile things to misbehave because until now a string containing an FQDN was expected.

Alternate approaches:

  • Keep external_url as-is and implement a new option, say additional_urls, for the desired functionality.

I am aware that overriding nginx['server_name']and nginx['proxy_set_header]['Host'] would stop the redirecting effect mentioned at the top, but this would not allow Gitlab-rails to leverage the multiple urls feature, such as displaying a git clone url according to the host the user is on or the host configured for the group or project.

Status

Work in progress - do not merge

Passing an array into external_url correctly changes server_name and proxy_set_header Host in the Gitlab Nginx config to allow for the application to be accessed from the urls specified. In other places, only the first element of the Array is used when an array is provided. Further investigation will be needed to ensure that using an array does not break anything. As of now, Gitlab-ctl reconfigure executes properly on Ubuntu 16.04 with both arrays and string passed in.

Discussion will also be needed to determine whether the feature is necessary, and if so how it should be implemented.

Merge request reports

Loading