Links to directories when behind a proxy ignore the proxy host
We're running Gitlab Pages over HTTP and only allowing HTTP access from an OAuth2 proxy so that we can enforce authentication before viewing any Gitlab Pages sites (see my comment on https://gitlab.com/gitlab-org/gitlab-ce/issues/33422#note_74620829) which works nicely most of the time.
When we have direct URLs to a page (such as <a href="foo/bar/index.html">
) this works fine but if we use a directory style link it breaks as it creates a protocol relative path to the non proxied URI which then shows a certificate error as it presents Gitlab's main certificate and if it had used a non protocol relative URL (by knowing that pages is running over HTTP and not HTTPS) it would then fail to connect as we don't allow non HTTPS traffic from anything other than the proxy.
At a quick glance, having not looked at the code base before, it looks like the issue is around https://gitlab.com/gitlab-org/gitlab-pages/blob/master/internal/domain/domain.go#L230 but I'd need to spend a bit more time looking at things to work out how to fix it exactly.