minac/minac.github.io

Re: How to get multiple domains pointing to GitHub Pages using Cloudflare

aolney opened this issue · 4 comments

Thank you for your tutorial. I'm trying to follow it and have some suggestions/questions.

For clarity, I'm defining custom domain 1 (CD1) as the custom domain with a CNAME record in the GitHub repo, and CD2 as the redirected custom domain

Cloudflare appears to require CNAME records in order for page rules to work - what records are you using? The options appear to be:

  • Point CD1 at CD2 (both www and apex)
  • Point CD1 at GitHub (again both www and apex

I chose the first option, which requires CNAME flattening for the apex redirect.

Also, it appears you are redirecting to https to https, which is what I needed to do, but it wasn't clear from your tutorial that you were in fact doing that. I got that to work using the following page rule

*CD1/* where CD1 is the apex

minac commented

@minac No worries, I've solved my specific case but am interested in how solutions compare. My post links to your solution.

minac commented

Hi @aolney. I'm happy you already got sorted.

I've actually deleted that domain so I don't have the records on hand anymore, but what I did was very similar to what you did, www > non-www CNAME on both sides, and then CNAME flattening between both custom domains.

The https part is a given to me since it comes for free and should be the default for every website so I was too lazy to explain. You did a better job so I'm linking back to your post! :)

Thanks for reaching out!

👍