Custom Hostname - Issue with Apex CNAME

I'm trying to set up a custom hostname from one of my other apex domains outside of Cloudflare into my one inside of it, and despite having the apex domain pointed towards the CNAME (flattened) and the returned IPs being the same as the custom hostname, it's saying it's using cloudflare and can't be activated and sometimes even that it isn't pointed towards it, which it is, is there any way to fix this?
33 Replies
Chaika
Chaikaβ€’11mo ago
Interesting, it should work as long as the other provider supports proxied CNAMEs/ANAMEs. What's the url of the domain you're trying to link, and the exact error in the Custom Hostnames tab for it?
π•Έπ–Žπ–‘π–‘π–Žπ–Š
The thing is my DNS is self hosted and doesn't support ANAME/flattened CNAME, I manually flattened it by grabbing the IPs from dig. Any idea?
Chaika
Chaikaβ€’11mo ago
What's the url of the domain you're trying to link, and the exact error in the Custom Hostnames tab for it?
π•Έπ–Žπ–‘π–‘π–Žπ–Š
i told you, it said its using cloudflare and cant be activated. it was my root apex domain millistice.com either that or it'd say sometimes that it isnt pointed at the zone
Chaika
Chaikaβ€’11mo ago
It says "its using Cloudflare"? I don't see that domain pointing at CF IPs right now. I've never tried apex proxying without the other domain using CF DNS, will have to try that sometime. CF does offer a proper way to do this, but Enterprise only: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/start/advanced-settings/apex-proxying/
Apex proxying Β· Cloudflare for Platforms docs
Apex proxying allows your customers to use their apex domains (example.com) with your SaaS application.
Chaika
Chaikaβ€’11mo ago
could just have some server handle redirects from apex -> www and have the custom hostname be www, another option
π•Έπ–Žπ–‘π–‘π–Žπ–Š
then how am i supposed to protect the apex with CF? to avoid downtime i actually took it off that and i am waiting for a fix before i try again
Chaika
Chaikaβ€’11mo ago
you wouldn't, you'd just have something silly handling the redirect and all your app logic/etc live on www which would be behind proxy
π•Έπ–Žπ–‘π–‘π–Žπ–Š
so you expect me to leave the apex exposed to DDoS? no thank you i don't see why i can't just use dig and get the IPs like i have done before that's basically what cname flattening is
Chaika
Chaikaβ€’11mo ago
It's not officially supported without using the enterprise addon and even more you're doing it really hackily by manually flattening it, Proxy IPs are not guaranteed/can change
π•Έπ–Žπ–‘π–‘π–Žπ–Š
what kind of logic is that? why on earth would they not allow the apex to be protected without enterprise? i am sorry but that makes 0 sense
Chaika
Chaikaβ€’11mo ago
Some of it is just internal pricing stuff I imagine, but they also would need to assign you static IPs that would never change
π•Έπ–Žπ–‘π–‘π–Žπ–Š
i dont see why i cant just use any ips that come off of the cname dig milliecdn.com A dig milliecdn.com AAAA that ran consistently using crontab should be sufficient this is clearly a bug
Chaika
Chaikaβ€’11mo ago
doing it via a cron is better, basically cname flattening if you run it often enough
π•Έπ–Žπ–‘π–‘π–Žπ–Š
my backend server literally does cname flattening on its own already for my existing protection provider so i dont see why the dashboard won't just activate my domain and that be it if it's pointing to the same IPs as the cname it doesnt matter if the CNAME is there or not
Chaika
Chaikaβ€’11mo ago
It might be strictly looking for the CNAME. I know it works if the DNS Provider is Cloudflare itself (maybe because they can actually see the target even if flattened), not sure about other providers. It's not setup right now so there's not much that can be debugged
π•Έπ–Žπ–‘π–‘π–Žπ–Š
i literally do this currently: dig geo-routing.nexuspipe.com +short that gives me an IP i then use sed to replace it i can try it but dont expect it to work haha
# dig milliecdn.com +short
172.67.212.172
104.21.37.193
# dig milliecdn.com +short
172.67.212.172
104.21.37.193
same exact IPs as yesterday
dig milliecdn.com AAAA +short
2606:4700:3037::6815:25c1
2606:4700:3034::ac43:d4ac
dig milliecdn.com AAAA +short
2606:4700:3037::6815:25c1
2606:4700:3034::ac43:d4ac
would you look at that, the AAAA is the same too see
Chaika
Chaikaβ€’11mo ago
yea that wording sounds like it's strictly looking for a CNAME I wonder if adding the pre-validation txt would bypass
π•Έπ–Žπ–‘π–‘π–Žπ–Š
and now it says this its added already the mixed up error messages clearly show this is a bug that shouldnt be the case if it is, whoever coded that is a bit of a bad programmer (no offence)
Chaika
Chaikaβ€’11mo ago
I would imagine that is happening is that it's realizing the txt is set and then moving onto that there's various stages of validation and such, it takes a sec to check things
π•Έπ–Žπ–‘π–‘π–Žπ–Š
if i spam refresh it says uh ya know this again now back to the other error
Chaika
Chaikaβ€’11mo ago
Refresh restarts that process so that makes some sense Curious though, was trying to find more info on that error
π•Έπ–Žπ–‘π–‘π–Žπ–Š
the DNS target needs to point to the SaaS zone
it literally DOES lol i mean... if you dig millistice.com that's what you'll get lol @Chaika someone had this same issue 2 years ago and they were ignored https://community.cloudflare.com/t/the-hostname-is-using-cloudflare/404681 found this too https://community.cloudflare.com/t/apex-proxying-works-for-one-host-with-com-tld-but-not-co-uk/425973 is there no way someone from CF could manually verify it?
Chaika
Chaikaβ€’11mo ago
Yea I saw a few of those before, lots of moving parts though. I was testing myself to see if I couldn't repro. It does work fine if I cname apex from a domain using CF DNS, was waiting for DNS Propogation on one not using CF DNS. After that could ask for clarification, it does kind of imply that it would work with DNS Providers who support flattening CNAME records and that was my previous understanding.
π•Έπ–Žπ–‘π–‘π–Žπ–Š
yeah thats weird why it doesnt work for me then i literally flattened it myself
Chaika
Chaikaβ€’11mo ago
to clarify right now all I've confirmed is it does work from a domain using CF DNS, the one using third party DNS is still pending/waiting for it to propagate so I can add it to CF
Chaika
Chaikaβ€’11mo ago
I tried adding an apex of an unrelated domain on my Enterprise account and it gives a different error
None of the A or AAAA records are owned by this account and the pre-generated ownership verification token was not found.
So it seems to me it might just be an Enterprise thing, but we'll see
π•Έπ–Žπ–‘π–‘π–Žπ–Š
ah @Chaika I've noticed it's now not giving off the whole "not pointed to the zone" error I've spam refreshed about 50 times and it's stuck on "is using cloudflare", seems like a case of spaghetti code πŸ˜† @Chaika this is really funny, so guess what? if I remove all my A records and vice versa it works then I just add them back and job done LOL
Chaika
Chaikaβ€’11mo ago
That's really weird, I can repro that. It looks like you're slipping through the activation conditions. Either CNAME equals, or Prevalidation TXT is set, but even if txt is set if it's pointed at Cloudflare but can't verify what, it fails, hmm problem with all the shared IPs is that it has no idea which account you could be pointing at (and why apex proxying assigns you your own static ones) you can get it to become active with just the TXT (a pre-validation method), but it gets blocked because it think its not pointing at the zone (real-time validation)
π•Έπ–Žπ–‘π–‘π–Žπ–Š
Yea A potential fix is to just ignore if the CNAME isn't there Or perhaps, just check what the backend IPs are and check those are there Eg
Chaika
Chaikaβ€’11mo ago
I'll ask later, I'm guessing they had a security reason to implement that block if its pointing to CF but not your zone. Those IPs are not unique to your account/don't identify your zone. But yea for now the workaround is just to use the txt prevalidation, add custom hostnamme, add txt record for prevalidation, wait until active and then add cname
π•Έπ–Žπ–‘π–‘π–Žπ–Š
Yep Maybe they could improve the UX by editing the UI to tell people to do what you stated
Want results from more Discord servers?
Add your server