Reputation: 4006
I have a self-hosted GitLab instance (version 14.x).
Recently I have setup GitLab pages. With my current setup (which is the standard setup as far as I can tell), GitLab pages are hosted on:
http[s]://group-or-username.pages.mydomain.com/subgroups/project
I do not want to use subdomains for each group or username. I want the group or username to be part of the path:
http[s]://pages.mydomain.com/group-or-username/subgroups/project
Is it possible to configure GitLab Pages this way?
The GitLab documentation mentions a workaround. However this is not an option for me.
Upvotes: 3
Views: 1676
Reputation: 40891
There is no way to directly configure pages in a supported manner to get this effect beyond what is described in the documentation. But there may be a way to work around this limitation with additional architecture.
You could, in principle, setup a reverse proxy (say nginx) configuration to do this, provided that you actually have the wildcard DNS (or similar solution) in place, at least for the reverse proxy server itself.
Something like this, in the case of nginx:
server {
server_name pages.mydomain.com;
location /(?<group_or_username>.*)/(?<pages_path>.*) {
proxy_pass http://$group_or_username.pages.mydomain.com/$pages_path;
}
}
You may want to consider using filters to rewrite the HTML content, for example, to fix absolute links that may be using the subdomain pattern.
Of course, GitLab will still display the subdomain pattern in the Pages settings UI, which is largely unavoidable, unless you want to modify the GitLab source code or put a proxy in front of GitLab itself.
Upvotes: 2