Gitlab pages "root" page
Asked Answered
E

2

6

I have set up a gitlab server and gitlab pages for our company internal gitlab. The configuration was made according to Pages domain with tls support without wildcard dns.

The pages work correctly and i can access the pages over the address https://pages.example.com/group/project as expected.

I was now wondering if there is a way to define the "base" or "root" page for the whole instance. That page would then be served on the address https://pages.example.com.

Currently, when I call https://pages.example.com in my browser it redirects multiple times to https://pages.example.com///////////.

The documentation describes ways of defining group pages but I have not found a way to define a "root" page.

It could also be a redirect to another page. Similar as it is done when you call https://pages.gitlab.io

Thanks for your help!

Edithe answered 8/3 at 13:48 Comment(1)
This question may be related: https://mcmap.net/q/1917390/-how-do-i-create-a-root-repository-for-a-subgroup/358532: looks like you can do this for a group/project, but not a subgroup.Bacchius
M
1

Followed the same setup as you, noticed this redirect loop.

I fixed it by adding this to my gitlab.rb:

pages_nginx['custom_gitlab_server_config'] = "# Fix redirect loop\n  location ~ ^/$ {\n    return 302 $scheme://$http_host/default/page;\n  }"

Then I ran the command:

gitlab-ctl reconfigure

Change 'default/page' to direct the user to the page you want to be default.

Mexicali answered 17/6 at 20:9 Comment(1)
Thank you, your solution worked flawlessly.Edithe
N
0

It looks like you have some kind of "trailing slash loop" going on that's not supposed to happen in the first place. Maybe it has to do with some config of your wildcard domain for this, or maybe some generic bad rule for removing trailing slashes.

Anyway, To my knowledge, Gitlab doesn't have a "root" page feature for the gitlab pages, but you can probably redirect to some static page you built elsewere and do a http 302 redirect using your reverse proxy configuration (that's probably what gitlab.com did with their pages).

You can even create this static page with gitlab pages. For example, in a repository you create an "about" gitlab pages (about.pages.example.com) and then redirect https://pages.exemple.com to https://about.pages.exemple.com

Neurotic answered 15/5 at 13:20 Comment(1)
Do you have an example or a link on how i could achieve that with the default omnibus deployment? I think it uses nginxEdithe

© 2022 - 2024 — McMap. All rights reserved.