GitLab Pages with custom domain redirects back to GitLab subdomain

I’ve set up a repository to use GitLab Pages Libby / tinie.st · GitLab It’s a static Nuxt 3 site.

It’s visible here with no problems:
https://tinie-st-horrorcheck-568f34c4e2491566b3d39fd7dd676a72e1c526cfc9.gitlab.io/

I set up a custom domain, tinie.st, and verified it and everything looks good on the Custom Domain page. It’s been over a day since I last changed the DNS, so the changes have propogated. However, when I go to https://tinie.st/, I’m redirected back to GitLab instead of staying on tinie.st.

When I do a curl, I see that it’s a 308 Permanent Redirect. I don’t think it’s from Nuxt, since the Nuxt site is 100% static and no JavaScript is loaded. So I think it must be from GitLab somehow.

Can anyone help?

1 Like

Figured it out! The problem was that I had “Use Unique Domain” checked. When I unchecked that box, the domain stopped redirecting.

2 Likes

This didn’t work for me. It’s quite confusing, to be honest.

If I disable Use Unique Domain, it won’t generate a unique url (and I have more Pages under my GitLab group), so it breaks things.

If I enable it, I can see the gitlab generated Page url,

I verify my domain test.foo.com
And in AWS Route 53 I add a record with name test.foo.com and type A pointing to 35.185.44.232 (because it must be an IP)
then GitLab can generate certificate without issues but when accessing https://test.foo.com
I get permanent redirection response and loads the gitlab unique domain page

I made an issue over here: "Use unique domain" causes a redirect back to gitlab.io subdomain when using a custom domain (#426435) · Issues · GitLab.org / GitLab · GitLab and linked your reply so they know about it!

Thanks very much.

It seems that now, for whatever reason, it worked with your advice to disable “use unique domain”

Probably DNS was caching something before

So, summarizing, for anyone having similar issue.

  • I have a group my-group with two repositories which use GitLab Pages.

  • One is called my-group/my-group.gitlab.io and therefore it serves GitLab pages as a group website at https://my-group.gitlab.io, which is great.

  • The other (the problematic) is called my-group/foo-saas-website and I have configured a custom domain to it test.foo.com

  • I verified the domain at my AWS Route 53, DNS by adding the TXT record as instructed

  • GitLab requests properly SSL certificate so that I could access https://test.foo.com

  • I added a CNAME record in my DNS with name test.foo.com and value my-group.gitlab.io

And that works well right now. Funny thing, I didn’t even have to set any base =“/foo-saas-website/” to my index.html

Thanks for your help!

Crossing fingers tomorrow my website is still accessible!

1 Like