Map Custom Domain Using Cloudflare DNS
After the CloudFront distribution is created, the next step is to map your custom domain to it using Cloudflare DNS. This ensures users access your site through your domain instead of the default CloudFront URL.
-
Locate the CloudFront distribution domain name from the distribution details page, for example:
d123abcd9xyz.cloudfront.net -
Sign in to the Cloudflare dashboard and open the domain you want to map.
-
Navigate to DNS → Records.
-
Add a new DNS record with the following settings:
Field Value Type CNAME Name Domain label (e.g., @,www,docs)Target Your CloudFront distribution domain name Proxy status DNS only (unproxied) 🔴 TTL Auto Example mappings:
Domain Name Target example.com@d123abcd9xyz.cloudfront.netwww.example.comwwwd123abcd9xyz.cloudfront.netdocs.example.comdocsd123abcd9xyz.cloudfront.netWarning
Do not enable Cloudflare proxy (orange cloud). The record must remain DNS only for CloudFront to correctly handle SSL and routing.
-
(Optional) Enable Always Use HTTPS if you want Cloudflare to enforce HTTPS redirects.
CloudFront already performs HTTP → HTTPS redirection, so this step is optional.- Go to SSL/TLS → Edge Certificates
- Enable Always Use HTTPS
-
(Optional) Disable Automatic HTTPS Rewrites if your application requires precise header behavior.
- Go to SSL/TLS → Edge Certificates
- Disable Automatic HTTPS Rewrites
-
Allow several minutes for DNS propagation (typically 1–10 minutes, up to 1 hour globally).