Skip to content

Do not call the API when host == --pages-domain

While working on #377 (closed) I discovered that we make an unnecessary API call to the internal API when the host is pages domain and access control is enabled.

GET /api/v4/internal/pages?host=pages.test HTTP/1.1
Host: gdk.test:3000
User-Agent: Go-http-client/1.1

We should not need to call the API when host==pages-domain.

Add a check to https://gitlab.com/gitlab-org/gitlab-pages/-/blob/master/app.go#L94

func (a *theApp) domain(host string) (*domain.Domain, error) {
	if host == a.Domain {
		return nil, nil
	}

	return a.domains.GetDomain(host)
}