I would like to transfer a domain registration to Cloudflare, but ran into difficulty with DNS and page rules, so my site broke and I had to revert to my original nameservers.
My current DNS provider has a very different way to configure URL redirection, so I’m having trouble figuring out how to accomplish the same thing with CF and also be able to test it prior to changing the NS records.
My need is extremely simple. I have a registered domain and use it for hosted Gmail. I have no problems setting up MX records.
I would simply like to have page rule that does the following:
*.example.com/* to forward to https://mail.google.com/hosted/example.com
I don’t have any A records.
How can I do this and more importantly, be able to test prior to changing NS records. I tried before and the TTL of the NS record at Cloudflare made it difficult to quickly change back after running into problems.
Wildcard isn’t really necessary, I would be fine by using example.com, www.example.com and mail.example.com (that’s actually what I’m currently doing at the existing DNS server). Thought wildcard would be more streamlined, but it’s certainly not required for my purpose.
Indeed I can query DNS records, but unfortunately that won’t let me test the page rule
I could probably figure out the API, but not sure what you would have me point to a pointless IP.
I don’t think you can guarantee that - it’s possible that without your NS servers pointing to Cloudflare the config may not yet be ‘active’.
Personally I’d move back to Cloudflare and work out your bugs instead of moving back and forth where you’ll get TTL and NS propagation issues. Once on Cloudflare TTL is pretty much instant (browser caching of a 301/302 is another matter) so changes and fixes can be made very quickly.
In your case you need DNS records for example.com, www.example.com, mail.example.com and a single Page Rule for:
*example.com/* to forward to https://mail.google.com/hosted/example.com
(not I’ve removed the ‘dot’ denoting only match subdomains of example.com in your pattern). The records you create for those three domains can be anything as long as you set the record to orange-cloud as no one will ever hit them (not with HTTP anyway) due to the page rule. I’d personally probably use a CNAME with a target of ghs.googlehosted.com as that’s what mail may use anyway in a non-Cloudflare world and keeping those targets will mean you’re more likely to remember what they’re for when you revisit in years time…
Saul, I’m hesitant to set the NS records just yet. I did that yesterday and users seemed to have trouble for about 2 hours even after I changed it back to the original. I think records at the TLD are cached for awhile regardless of what Cloudflare does. (not quite sure how that works, but rather not risk phone calls again, if I can avoid it)
My domain went to “active” status after changing NS records to Cloudflare and stayed “active” even after going back to the original DNS server. I can query the clouflare servers and see my records, so it seems to work.
Thanks much for catching the issue with the ‘dot’. I wouldn’t have caught that on my own as it seems counterintuitive to me.
Indeed setting a dummy A record to an IP allows for page rules to work (with a corresponding entry in the hosts file for testing).
I think all the parts are working (DNS plus page rules). Now it’s just a matter of giving users some warning before updating the NS records for real.