Unreachable gitlab page with custom domain

亡梦爱人 提交于 2021-01-29 15:00:57

问题


I created a site with Hugo and I hosted it as a gitlab page.

To assign my custom domain I followed the instructions of this document of gitlab.

I created three DNS records:

  1. one of type A with name @ and value 35.185.44.232;
  2. one of type TXT with name @ and value _gitlab-pages-verification ... for the verification of the ownership of the domain;
  3. one of type A with name www and value 35.185.44.232.

If I access the site using the address https://example.com everything works normally; but if I log in using the triple W (www.example.com) I get from gitlab the error message 401 You don't have permission to access the resource. The resource that you are attempting to access is protected and you don't have the necessary permissions to view it.

How can I correct it?


回答1:


Try a CNAME instead of a second A record for your WWW. subdomain. Having two A records - one that points to your naked domain and one that points to your WWW-domain is either causing redirect error or simply does not exist since it, as your origin's subdomain, must exist as a separate entity on GitLab OR you can not concern yourself with it by using a CNAME record as I previously recommended and using a directory-style (as opposed to a subdomain-style) setup for your site. Each has its own benefits as well as drawbacks. I use the CNAME method and have a WWW-subdomain setup on GitLab in order for my sites to grant that extra bit of security and privacy to visitors that having a TLS cert installed on the WWW-subdomain offers.



来源:https://stackoverflow.com/questions/60515412/unreachable-gitlab-page-with-custom-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!