this post was submitted on 13 Sep 2024
6 points (100.0% liked)

WebDev

1137 readers
2 users here now

Community for all things Web Development related.

founded 1 year ago
MODERATORS
 

Crossposted from https://lemmy.world/post/19723787

My Gitlab Pages site works well under domain.com but not under www.domain.com. The www subdomain leads to a 401 message: "You don't have permission to access the resource."

My DNS has a CNAME entry for www pointing to domain.com. When I asked the DNS provider what the problem might be they said "Please contact your hosting provider and provide us with the record needed to be set for www in the DNS zone. The changes should have worked already."

The reason I need this is that some old-school people visiting our website still type www. into the URL bar.

you are viewing a single comment's thread
view the rest of the comments
[–] ptz@dubvee.org 1 points 1 week ago (1 children)

Do you have:

  • A virtual server listener configured for the www.domain.com domain as well?
  • A corresponding SAN in your cert that covers www.domain.com

For your error, it's probably the first one. When the traffic comes in under www.domain.com, there's no virtual server configured to listen on that hostname and it's likely falling back to a default response.

Not sure how that works with Github pages, but in general, that's usually what it is.

[–] FarraigePlaisteach@lemmy.world 2 points 1 week ago (1 children)

It wouldn't be the first time that Gitlab documentation[1] contradicted reality, but I don't see an option in Gitlab Pages to achieve what you describe.

1: https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/#redirect-wwwdomaincom-to-domaincom-with-cloudflare

[–] ptz@dubvee.org 1 points 1 week ago (1 children)

Ah. Looks like Gitlab just does a redirect versus serving the same content under both domains.

Assuming you followed all the steps, then I'm not sure what the problem could be.

Thanks. I followed them as closely as possible. Their instructions are for Cloudflare whereas I'm using Letshost. But Letshost haven't figured it out either since I notified them.