401 error when adding custom domain to gitlab pages with Namecheap

After getting the site running on https://username.gitlab.io/project name/ I tried adding a custom domain. The domain is fitshapeprogressions.com.
But this results in the following error:

I set the pages access control to ‘everyone’ so why would there be a permission error?
image

I set things up as follows.

For the DNS site of things I followed this explanation: namecheap docs
Ending with these settings:

On the gitlab site of things the domain got successfully verified
image

I’ve looked at a similar problems but proposed solutions don’t seem to work
401 Unauthorized error for gitlab page deployed with Publii

401 error when adding custom domain to gitlab pages

Any ideas as to what might be causing the error?

Hi,

I think the A records in your DNS configuration are not correct. The challenge with TXT records looks fine.

$ dig fitshapeprogressions.com A

fitshapeprogressions.com. 1653	IN	A	185.199.111.153
fitshapeprogressions.com. 1653	IN	A	185.199.109.153
fitshapeprogressions.com. 1653	IN	A	185.199.110.153
fitshapeprogressions.com. 1653	IN	A	185.199.108.153

resolves to IP addresses owned by GitHub but not GitLab. The correct A record is documented here, at the time of writing this is 35.185.44.232.

Verify this works by accessing the server. Note that your zone time-to-live (TTL) is set to 1800 seconds / 30 minutes - this may be the time until caching resolvers take up on the changes.

For adding www as a subdomain, you need to use the CNAME record, and an addition TXT record with the updated domain, see here: Custom domains and SSL/TLS Certificates | GitLab

I would not bother though, the www. prefix for websites is old legacy requirements by browsers.

Cheers,
Michael

1 Like

Thanks for the answer Micheal. I’ve added 35.185.44.232 and removed the other A records. dig now shows the new ip and the TTL should have expired by now. But the error still shows. Any idea as to what else might be going wrong?

Hi,

it seems that Let’s Encrypt did to take up on the domain name. Accessing the raw domain at http:// shows

If I change that to https:// it says

Please share a full screenshot of your pages settings page to double check. Probably the domain name is wrong or it shows another error.

image

Cheers,
Michael

1 Like

It seems Let’s Encrypt was not enabled. After enabling the site works on https. Thanks for all the help.

1 Like