401 Unauthorized error for gitlab page deployed with Publii

Hi everyone,

I already used gitlab pages and custom domains without any problems. I followed the guide here about adding a custom domain on gitlab pages and I was able to enable HTTPS and A record while I was not enable to setup CNAME record to redirect www.example.com to example.com.
I’m using Publii and a similar problem is described here.
dig www.example.com
;; ANSWER SECTION:
www.example.com. 10800 IN CNAME example.gitlab.io.
example.gitlab.io. 300 IN A 35.185.44.232

Any idea?

Hi,

please provide the real domain name for better troubleshooting. Also, please share a screenshot of the pages setup in order to see whether everything has been verified correctly.

Cheers,
Michael

1 Like

Hi,
I prefer to not show my URL. I double checked with domain provider too and I can confirm that the configuration is correct as described here. Indeed, the url redirect well to gitlab, but I get 401 unauthorized error. It is a problem on gitlab side similar to one described here.

Hi,

with that few details, I’m afraid I can only guess. One of them is permissions for the pages deployment for your project which may be wrong/missing.

Cheers,
Michael

The dig command shows that DNS is configured correctly. Moreover, it is quite trivial to follow the instructions here.
This is my configuration:

  1. General Settings -> Visibility, Project Features, Permissions -> Pages access control = Everyone
  2. Set the job as name pages

GitLab CI

image: alpine:latest
pages:
stage: deploy
script:

  • echo ‘Nothing to do…’
    artifacts:
    paths:
    • public/
      only:
  • master

Hi,

thanks for the reply. I honestly don’t know what to answer next - we don’t know your URL, project or have seen a screenshot. If you are still not wanting to share more details to get some helping hands, here’s a few topics google returns when searching for gitlab pages 401 unauthorized as a last idea for your research:

Cheers,
Michael

Thank you for the reply. I have the same problem of your first link, but the solution proposed does not work. As I reported earlier, it seems that for some people, the solution proposed does not work.

1 Like