401 error when adding custom domain to gitlab pages

Hey, I host my hugo blog on https://gitlab.com/hubutui/hubutui.gitlab.io, and add a custom domain www.butui.me according to https://gitlab.com/help/user/project/pages/custom_domains_ssl_tls_certification/index.md#set-up-pages-with-a-custom-domain. My domain was bought from Namecheap, and I use Cloudflare. I’ve checked that my domain is verified in the gitlab repo pages setting. Here is my DNS setting in Cloudflare:


I also add the page rule as suggested by https://gitlab.com/help/user/project/pages/custom_domains_ssl_tls_certification/index.md#redirecting-wwwdomaincom-to-domaincom-with-cloudflare. Here is all my page rules in Cloudflare:

However, when I visit butui.me, I was redirected to https://gitlab.com/users/sign_in or just 401 error. Any suggestion?

I found a solution here. Gitlab Pages website is restricted
I need to update the page visibility. It seems that this feature is not documented yet?

2 Likes