I have added my domain to the GitLab pages settings and verified it. The page works fine when accessing it via example.com, however www.example.com returns a 401 error from GitLab (You don't have permission to access the resource.).

My DNS entries:

  • A record @ (The GitLab Server)
  • CNAME record www username.gitlab.io.
  • TXT record _gitlab-pages-verification-code [verification code] to verify domain to GitLab
  • URL Redirect Record www https://example.com Unmasked (This entry does not seem to be working, even after waiting multiple days.)

I'm using Namecheap as domain name provider. The hosted web page is a Flutter web app in one case, and a static website created with Jekyll in the other.

I have tried re-adding the domain to GitLab pages, but to no avail. The repository is set to public.

  • You should redirect www.example.com to example.com, or vice versa Nov 10, 2021 at 20:00
  • That's what I tried to do with the last URL Redirect Record. To redirect www to the normal domain. But it's not working. Nov 10, 2021 at 20:33
  • 2
    DNS doesn't have redirect record, maybe your namecheap DNS has custom rule. Maybe remove your cname record will working Nov 10, 2021 at 21:19
  • 1
    Did you verify your domain with GitLab? Also, your CNAME record and your "Redirect" (pseudo-)record conflict, you'll want to remove one of them. Remove the CNAME if you want your registrar's server to handle the redirect, remove the "Redirect" record if you want GitLab Pages to handle the redirect. Nov 10, 2021 at 21:33
  • @MaximillianLaumeister Yes, the domain is verified. I removed the CNAME record, leaving only the Namcheap URL redirect, and it seems to work now (even though I think I have browser caching issues, but it works on new browsers and incognito mode). If you write an answer, I'm willing to accept. Thank you! Nov 15, 2021 at 12:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.