I'm running into an issue with my store application that requires my clients to point their domains directly to my service. The problem is that some domain providers don't allow CNAME records at the Apex domain (like example.com), which is causing a bit of a headache. Since all my traffic is routed through Cloudflare, I really want to avoid exposing my IPv4 address directly. What are some workarounds or solutions to this problem?
2 Answers
Creating a subdomain like store.* should generally not be a big deal, but many clients prefer using their Apex domains. A common solution is to provide an A record with your IPv4 address for the root domain while still utilizing Cloudflare for security. Just keep in mind how strict their registrar is regarding DNS records.
Unfortunately, you can't set a CNAME record for the root domain due to restrictions outlined in the RFC. The best approach is to set a CNAME for the 'www' subdomain and then use a 301 redirect to point the root domain (example.com) to 'www.example.com'. This keeps you compliant with the rules and gets the job done on your end.
Related Questions
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads