Connecting a Domain to Craft Cloud

Sites hosted on Craft Cloud can serve traffic on any domain you own.

To set up a domain on Cloud, you will need access to its DNS records, which are often managed via your registrar or existing host.

Preview Domains #

Every environment in your Cloud project gets a unique preview domain. Preview domains always end in preview.craft.cloud, and will include your project and environment name. A complete preview domain looks something like this:

project-name-environment-b62dec18.preview.craft.cloud

Changing the name of a project or environment may take a moment to update in our routing layer. If you have other services that rely on a consistent hostname (say, for the delivery of webhooks), consider pointing a subdomain at the environment.

Adding a Domain #

In your Cloud project, navigate to Domains, then click New domain.

Provide the root domain you wish to add, and select an environment if you want to tie it to one right away. You aren’t required to point the root domain at Cloud, but you must verify ownership of it before Cloud will accept traffic to it or any subdomains.

A www subdomain is not automatically created for you. You must add it explicitly, if you wish to use it in addition to the bare domain.

Verification #

Cloud will provide a CNAME verification record, which must be added wherever you manage the domain’s DNS. Adding and verifying a domain does not automatically start routing traffic to the selected environment!

Routing #

Depending on your DNS provider (and the TTL or “time to live” of any existing records), it may take anywhere from a couple of minutes to 24 hours for traffic to be routed to Cloud.

DNS records are cached for different amounts of time by different providers around the globe. You may see changes before or after your client and their customers—especially if you access the Internet from different regions.

Heroku has a great guide that covers some of this technology, in the same context. If you are unfamiliar with DNS, consider starting with the domain name glossary section, or flipping through Cloudflare’s How DNS Works series!

To send traffic from a verified domain to Cloud, add the records below. Keep in mind that making changes to your DNS can result in downtime. Read more about how to prepare for going live.

The preferred way of routing traffic to Cloud is via a CNAME record:

Record TypeValue
CNAMEedge.craft.cloud

All DNS providers support CNAME records on subdomains (like www), but some do not accept them at the root or “apex” domain—sometimes called “CNAME flattening.”

If your provider does not support CNAME flattening at the root, you can still connect your domain to Cloud. Instead of the single CNAME record, add these two A records:

Record TypeValue
A104.17.124.41
A104.17.125.41

You should never need to use A records for subdomains.

The only difference between A and CNAME records is that in the event we add or change edge IPs, you may need to make updates to your DNS configuration. We will not make this kind of infrastructure change without providing customers a reasonable and clear timeline for making required updates.

Subdomains #

Each domain can have any number of subdomains. Subdomains can point to the same environment as the primary domain (great for multi-site projects) or a different environment (perfect for a staging environment).

SSL #

Every domain that sends traffic to Craft Cloud is automatically protected with SSL by Cloudflare. You do not need to manage certificates, redirection, or any other configuration—Cloud takes care of this for you, at the edge.

Cloud also sets the @web alias to ensure all URLs are generated with the secure https:// protocol. The only place we don’t know what @web should be is on the CLI—if you need to generate URLs from a command (or queue job), you may need to define this alias in your application config.

Nameservers #

Craft Cloud does not include domain registration or DNS management tools. You and your clients will still need to arrange the purchase and setup of a domain.

Pricing #

Every Cloud project includes one root domain. You may add as many subdomains as you need, at no additional cost. Each additional root domain is billed at $10/mo. Read more about Cloud pricing.

Applies to Craft Cloud.