I have a question that is driving me nuts. I am tinkering with the new Google Sites system. But, there is a small configuration requirement that I can’t seem to figure out. I can set up a mapping on the Google Sites end of things with a CNAME (usually “www”) and that tends to work. But, the root domain becomes a problem. There is no mapping or A-record to conduct any type of forwarding to the “www” CNAME within Google - so, it needs to be external.
TLDR; www.example.com works. example.com dies.
In the past, I would just set up domain forwarding via the domain registrar but I am keen to do the same thing on Cloudflare. Yet, I am missing something obvious. How does one direct the root domain to resolve on the CNAME “www”? I have no IP to point to and this is where I am getting lost.
I know this must be simple to fix but I am just banging my head against the keyboard. Any thoughts would be awesome.
Some systems don’t accommodate CNAME at root. So you need to set up a Page Rule here to do the redirect.
Change the DNS entry for example.com to be an A record pointing at…220.127.116.11 (it really doesn’t matter what you pick) and make sure it’s set to so Page Rules will intercept the request before it tries that IP address.
Match: example.com and do a URL Forward code 301 to http(s)://www.example.com
Thanks for your help @sdayman. That is the piece I was failing to understand. As long as Cloudflare is intercepting requests for the root, the page rules redirect will take over and forward it along. The IP address is irrelevant.
You are a god, sir!
For those who stumble across this posting in the future, this is a Google Sites configuration with Cloudflare:
- Set up your site Google Site.
- Make your site public.
- Apply the domain mapping as instructed by Google’s documentation (mapping “www” to the site):
- Log into your Cloudflare account.
- Add your domain to Cloudflare and give it time to kick over (name servers, DNS, etc).
- Add “www” as a CNAME and connect it to the appropriate entry (at this moment, it is “ghs.googlehosted.com” but could change in the future).
- Add an A record for your domain (selecting your IP address as 18.104.22.168 or 22.214.171.124) – although, you could just leave the IP address that was imported when you started your Cloudflare account/domain configuration. I suggest changing it to public DNS IP addresses so that you are not leaving an old IP in the record. Just my personal preference.
- After the entries are added, make sure the Cloudflare “orange cloud” is active on both entries. This enforces the traffic to be routed through Cloudflare.
- Go to Page Rules.
- Add a page rule to redirect your root (TLD) to “www”.
- Under the Cypto tab of your domain, set your SSL to Full. Flexible SSL may cause redirect loops as Google Sites redirects all traffic to HTTPS.
Just a quick summary as I had to bootcamp my brain through how to understand the Page Rules system:
That should do it.
If I have anything wrong, please update this thread with corrections.
I have run into a new problem. Flexible SSL and Google Sites don’t like each other since the HTTPS requests need to happen on both ends. I will add this to the list above.
If you are getting the error of too many redirects, this is most likely the culprit:
I did this recently. If it is your main GSuite domain, you can do this via the Google Admin pages. Log into the main page, then click on Domains then under your primary domain you can tell it to redirect the naked domain to www. It makes you set up a new A record for @ but it will also work in Cloudflare if you CNAME flatten the root and direct it to “ghs.googlehosted.com”.
In my own quest to do this for two domains, I realized if the domain you are trying to do it for is a secondary domain in GSuite, you will have to make a page rule in Cloudflare (you get 3 free for each domain) to URL Forward the naked domain to www
Correct. The main pages in question are only secondary domains.
This topic was automatically closed after 14 days. New replies are no longer allowed.