Can't get my gitlab pages site working with "www" prefix

Hi, I have created my website with gitlab-pages ans a custom domain,
I have added the domain in gitlab. The site works well with :, secured with let’s encrypt. :grinning:

Unfortunately, it does not work when I go to : I have a 401 Error “- You don’t have permission to access the resource.”

My name server is OVH, and I have followed this documentation : , with this configuration :

I also tried with 2 separate domains in Gitlab : and, but the lets’s Encrypt certificate can not be validated for the second domain, and so https is not working.

Do you have any idea?

Thank you in advance,


Hi @Sylvain, did you manage to solve this issue? I have the same problem (also using OVH) and none of the solutions I found on the forum helps :confused: I added my root domain with DNS A record and TXT verification successfully (so works fine and is encrypted), but cannot do the same for I tried:

  1. adding CNAME www to - resulted in 401 error
  2. adding as New Domain and and TXT verification passed, but I can’t validate Let’s Encrypt and when I enter I got error “DNS_PROBE_FINISHED_NXDOMAIN” (in all browsers and devices). Only if I add DNS A record it works, but it means I treat www the same as my root domain, is that correct?

Also I didn’t understand why the documentation suggest adding both TXT and CNAME for subdomain - when I try to do this in my DNS zone I got error stating I can’t add both TXT and CNAME records for one subdomain (sorry if it’s obvious, but I’m a total rookie).

1 Like

Even I have the same problem. I use is working fine for me. TXT verification with is passed with Gitlab. I added CNAME record for redirecting to, but still, I am getting the error " 401

You don’t have permission to access the resource." one of Gitlab permission errors. @AlexC , @Sylvain any leads on this?

FYI, I use Google domains to get the domain name.

I have this issue as well. works fine, but does not resolve.

I’ve tried following these steps with no luck.

The same for me, before with OVH and now that I’ve migrated to AWS Route 53 is the same issue.

I’m seeing this issue. CNAME entry for www subdomain yields the error message mentioned above from gitlab " You don’t have permission to access the resource."

I think it has to do with the pages being in a project url, as in:

I fixed this for my site by adding the “www” version of the name as a separate domain.

  1. Go to Deployments → Pages
  2. Click “New domain”
  3. Enter “
  4. Create a new TXT verification record in DNS when prompted. This is not the same verification code as for “, even though the example in the documentation uses the same value for both.
  5. Back in Gitlab, click the Retry Verification button (looks like a curly arrow).
  6. If you are using Let’s Encrypt certificates, then should start working after a few minutes.