1

I'm running into an issue with a new site I just launched for a private repo but one site works and the other generates a 522 so I'm wondering if it's due to my CNAME. Here's a list of what I've done.

In the domain provider I modified the nameservers to point to Cloudflare as directed. In Cloudflare I've setup each site and pointed to Github Page's IPs as directed:

enter image description here

For site A I have a CNAME as an alias with a value of username.github.io. For site B I had to remove the CNAME file when added to site B due to the domain URL pointing to site A even though in Jekyll's _config.yml the URLs were:

site A

baseurl: ""
url: "http://siteA.com" 

site B

baseurl: ""
url: "http://siteB.com" 

Both sites are built using Jekyll and uploaded to a directory named /docs but one is a blog and one is an app landing page. I'm getting reports that site B is throwing a 522:

enter image description here

The only difference from A & B is that A has a CNAME file with username.github.io. When I add a CNAME to Cloudflare site B the URLs are incorrect so I'm wondering in my CNAME on Cloudflare can I code it as:

Site A

username.github.io/siteA-repo

and

Site B

username.github.io/siteB-repo

both sites under Settings > Source have master branch /docs folder selected. Both sires have SSL enabled.

Reference setups:

After contacting Github the reply:

This error usually means there's a configuration error on Cloudflare's end that means it's not pointing towards Github.

From the information you've sent (same as above) it looks like your domain has been set up to point to the correct IPs, so it should be pointing towards Github.

Gʀɪᴍ
  • 111
  • 3

1 Answers1

0

In case anyone is wondering, then yes, you should do this to avoid potential 522 errors (only if you're using Cloudflare). The issue has gotten worse recently (since early June 2023) and 522 errors seem to appear a lot of the time.

To fix this, point your CNAME for your domain directly to your GitHub pages domain (username.github.io) for all sites hosted on the same account. For example, if you have a repo called username.github.io and another repo called docs, and you want username.github.io to be on www.example.com, and docs to be on docs.example.com(Image):

Record Name Content Proxy status
CNAME www username.github.io Orange cloud
CNAME docs username.github.io Orange cloud

Then, you can set username.github.io's custom domain to www.example.com and docs' to docs.example.com without any errors.

Also, don't point wildcards (*.example.com) to your repository without adding individual records for each domain, because this will also trigger occasional 522 errors.

Still no clue on how this triggers the error, though.