Unreachable gitlab page with custom domain

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 ;
  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 .

In my gitlab control panel Settings/General/Visibility/Pages is setted to “Everyone”.

If I access the site using the address https://torinoresponsabilitamedica.it everything works normally; but if I log in using the triple W (https://www.torinoresponsabilitamedica.it ) 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?