Skip to content

Issue on composer Package with Relative URL installation

Hi all

We setup GitLab as a self-hosted version. We use a relative URL i.e. https://www.xyz.com/gitlab, the setup is like described https://docs.gitlab.com/omnibus/settings/configuration.html#relative-url-requirements

Now we want to use the integrated composer package. As described, we put in our composer.json (on external server, for installation) the repositorie like bellow.

"repositories": [
    {
      "type":"composer",
      "url":"https://www.xyz.com/gitlab/api/v4/group/1/-/packages/composer/packages.json"
    }
]

The problem, on installation with composer require XYZ, composer display us an error.

[Composer\Downloader\TransportException]                                                                                                             
  The "https://www.xyz.com/api/v4/group/1/-/packages/composer/abc/def.json" file could not be downloaded (HTTP/1.1 404 Not Found)

If we check the main packages.json (https://www.xyz.com/gitlab/api/v4/group/1/-/packages/composer/packages.json) we see there a inside

  • "providers-url":"/api/v4/group/4/-/packages/composer/%package%.json"

And how composer tell us, he can download the further json file. Because the URL starts with /api and not with /gitlab/api. The issue occurs because we use a relative url, and inside the packages.json the relative URL is not included in the path. Any possibility to override the providers-url and put there the relative URL?