GitLab Pages custom domain configuration when Pages is running on the same server as GitLab

Hi there!

I have a self-hosted GitLab instance with pages up and running. It’s got TLS enabled for both GitLab itself and Pages. The same VPS currently hosts GitLab, a GitLab Runner, and GitLab Pages. With this setup in place, I next wanted to configure custom domains. However, the docs tell me that there are three ways to configure Pages with custom domains:

  1. Put Pages on a different server from the main GitLab instance
  2. Use the same server, but use a secondary IP
  3. Configure a proxy to make Gitlab and pages use different ports to each other.

I intend to use the third option; I am here simply to make sure I understand how this works. In my mind, it works like this:

  1. Configure a proxy to listen on port 443
  2. Configure GitLab and GitLab pages to both listen on non-standard ports (ex gitlab on 8443 and pages on 9443)
  3. Configure the proxy to rewrite any incoming request on port 443 based on the domain name in the request; if the request is a pages domain, rewrite it it to port 9443, if it is the main instance domain, route it to 8443.

Is my understanding of this correct? I don’t want to mess up my GitLab installation.