Stable
Run GitLab behind BusinessProxy App Gateway
Step-by-step setup for publishing a self-hosted GitLab through BusinessProxy without exposing the GitLab server directly.
Steps
Follow these in order.
- 01Choose one canonical domainGitLab redirects, cookies, assets and WebSocket endpoints must use the same public host.
- 02Prepare the GitLab originLet BusinessProxy terminate public TLS and make GitLab listen on plain HTTP inside the private network.
- 03Create the BusinessProxy private appPublish GitLab through the connector and bind the custom domain that matches GitLab external_url.
- 04Verify redirects, assets and WebSocketA successful setup returns the sign-in page and loads CSS, JavaScript and live endpoints from the same public domain.
- 05Troubleshoot common failures502, pending assets, redirect loops and CSRF failures usually point to URL, scheme or upstream TLS mismatch.
Reference
Implementation details for setup and review.
- Do not leave the GitLab upstream directly reachable from the public internet.
- Use one permanent customer domain, for example gitlab.example.com, instead of a temporary system alias.
- Run the BusinessProxy connector where it can reach the GitLab HTTP endpoint.
- Recommended shape: https://gitlab.example.com.
- Avoid opening the same GitLab through several public aliases; cookies and redirects can become inconsistent.
- Create the DNS record required by the BusinessProxy custom-domain flow and wait until the certificate is active.
external_url 'https://gitlab.example.com'
nginx['listen_port'] = 80
nginx['listen_https'] = false- Run sudo gitlab-ctl reconfigure after editing /etc/gitlab/gitlab.rb.
- If you deliberately keep HTTPS on the GitLab upstream, use a certificate trusted by the connector host or disable upstream TLS verification only for that private app after understanding the risk.
curl -I http://gitlab.internal/users/sign_in
curl -I -H "Host: gitlab.example.com" http://gitlab.internal/users/sign_in- The response should be HTTP 200 or a normal GitLab redirect, not a TLS error or connection timeout.
- If GitLab redirects to another host, fix external_url before continuing.
- Public/custom domain: gitlab.example.com.
- Upstream URL: http://gitlab.internal or another internal HTTP URL reachable by the connector.
- Rewrite redirects and cookie domains should stay enabled unless support asks otherwise.
- Verify upstream TLS can stay disabled only when the upstream URL is HTTP. For HTTPS upstreams, the setting controls certificate verification, not GitLab URL generation.
- Expected URL in the browser: https://gitlab.example.com/users/sign_in.
- DevTools Network should not show static files hanging forever as pending.
- If GitLab opens but later redirects to a different host, fix GitLab external_url and reconfigure GitLab again.
- Use the private app diagnostics first; it checks the path from connector to upstream.
- Disabling Verify upstream TLS helps only with upstream certificate trust. It does not fix a wrong external_url or redirect loop.
- external_url must be https://gitlab.example.com, not the internal host and not a BusinessProxy temporary system alias.
- If GitLab is behind BusinessProxy TLS termination, nginx listen_https should normally be false.
- Clear browser cache or service worker state after changing GitLab public URL settings.
- Do not mix gitlab.example.com and a *.business-proxy.com system alias in the same browser session.
- After changing external_url, sign out and clear old GitLab cookies for the previous host.
- For the first rollout, test web sign-in, project browsing, repository view, merge requests, artifacts and WebSocket/live UI behavior.
- If users also need Git over SSH, plan that separately. This guide covers the GitLab web application path.
- Keep a direct administrative recovery path available on a restricted private network for maintenance.