Skip to content

Internal API access drops URL path component

I am using the GitLab CE Docker images for 13.12 and run GitLab Pages on a separate server. My setup still uses disk based configuration and all pages are accessible. I have gitlab_pages['inplace_chroot'] = true and set external_url to point to my GitLab instance.

Preparing for an upgrade to 14.0 on a test setup I ran into an issue contacting the GitLab server's API. This seems to be caused by the fact that my GitLab instance is hosted on a URL like http://server.example.internal/gitlab.

On 13.12, I see the following in the GitLab Pages logs

==> /var/log/gitlab/gitlab-pages/current <==
{"level":"info","msg":"Checking GitLab internal API availability","time":"2021-07-01T01:03:21Z"}
{"error":"failed to connect to internal Pages API: Get \"http://server.example.internal/api/v4/internal/pages/status\": dial tcp: lookup maniac.machine.easy on [::1]:53: dial udp [::1]:53: connect: cannot assign requested address","level":"warning","msg":"attempted to connect to the API","time":"2021-07-01T01:03:21Z"}

Note the absence of the /gitlab path component in the URL!

After I copied /etc/resolv.conf to an etc/ directory directly below gitlab_rails['pages_path'], that changed to

==> /var/log/gitlab/gitlab-pages/current <==
{"level":"info","msg":"Checking GitLab internal API availability","time":"2021-07-01T01:20:45Z"}
{"error":"failed to connect to internal Pages API: HTTP status: 404","level":"warning","msg":"attempted to connect to the API","time":"2021-07-01T01:20:45Z"}

For the above GitLab Pages log entry, I see the following in the logs on my GitLab server

==> /var/log/gitlab/nginx/gitlab_access.log <==
10.11.55.227 - - [01/Jul/2021:01:20:45 +0000] "GET /api/v4/internal/pages/status HTTP/1.1" 404 1576 "" "Go-http-client/1.1" 1.99

confirming that the /gitlab path component is ignored.

I have tried setting gitlab_pages['internal_gitlab_server'] = http://server.example.internal/gitlab but that didn't make a difference.

Despite all of the above, I am able to access pages using 13.12. So far so good 🤔
However, when I add gitlab_pages['domain_config_source'] = "gitlab" to my 13.12 configuration, all I get is 502 HTTP status error pages 😭

Seeing that 14.0 requires access to the internal API, it seems I will loose GitLab Pages functionality if I upgrade 😟