Skip to main content

Introduction

Laravel Cloud can host the DNS for your domains. When Cloud is the authoritative DNS provider for a domain, it writes the records your environments need and issues SSL certificates on your behalf, so connecting a domain or a new subdomain no longer requires editing records at another provider. There are two ways to host a domain’s DNS on Laravel Cloud:
  • Buy the domain in Laravel Cloud. Domains registered through Cloud use Laravel Cloud’s DNS automatically.
  • Delegate an existing domain’s nameservers. Keep the registration at your current registrar and point the domain’s nameservers at Laravel Cloud.
If you would rather keep your DNS where it is, you can continue to add a custom domain by creating records at your existing DNS provider.

Delegate nameservers to Laravel Cloud

Delegating nameservers moves a domain’s DNS to Laravel Cloud while the registration stays with your current registrar.
1

Add the domain

Open Network > Domains in your organization, select New domain, then select Add existing. Enter the root domain you want to add (for example, example.com) and select Add domain. You can’t add a subdomain, such as app.example.com, on its own. Add its root domain instead, then create subdomains once Laravel Cloud has verified the domain’s nameservers. Laravel Cloud takes a moment to set up the domain’s DNS and assign its nameservers.
2

Copy your existing records

Once the nameservers change, Laravel Cloud answers every DNS query for the domain, and any record that is not in Cloud stops resolving. Open the domain on the Domains page to see the Before you switch nameservers section. Cloud checks the domain’s current DNS for common records, such as the root domain’s A, MX, and TXT records, www, _dmarc, and common DKIM records, and lists any that Cloud does not have yet. Select Add these records to Laravel Cloud to copy them.This check does not find every record in your zone. Compare the domain’s records with those at your current DNS provider, and add anything missing with Add record. To add many records at once, export a zone file from your current provider and paste it into the Zone file tab of the Add record dialog.
3

Update the nameservers at your registrar

Laravel Cloud shows the nameservers assigned to the domain, such as ns479.laravel-dns.com. Sign in to your registrar and replace the domain’s existing nameservers with the ones shown in the dashboard. Different domains may be assigned different nameservers, so always copy the nameservers shown for that domain. If your registrar only accepts two nameservers, choose any two. Do not keep your previous provider’s nameservers alongside Cloud’s.
4

Wait for Laravel Cloud to verify the nameservers

While Cloud waits for the change, the domain is shown as Awaiting nameservers. Cloud checks the registry directly, so it usually verifies the change within minutes of your registrar publishing it. You can also select Check nameservers to check right away. Once verified, the domain’s nameservers are shown as Laravel Cloud with the date they were verified.
If Laravel Cloud cannot verify the nameservers within about three days, it removes the domain, and you can add it again when you’re ready. An organization can have up to five domains awaiting nameservers at once.
If DNSSEC is enabled for your domain, disable it at your registrar and wait for the DS record to expire before you change nameservers. Laravel Cloud warns you when it detects a DS record. Cloud does not sign zones with DNSSEC, so leave DNSSEC disabled while Cloud hosts the domain’s DNS. Leaving it enabled will cause the domain to stop resolving.
You can confirm which nameservers are serving your domain from the terminal:

Attach a domain to an environment

Once Laravel Cloud hosts a domain’s DNS and its nameservers are verified, you can attach the domain, or any of its subdomains, to an environment. In your environment’s network settings, select New domain, then select Connect domain, and enter or pick one of your organization’s domains. You can also select Connect next to the domain on the Domains page. You will choose whether to enable wildcard support and, for root domains, how www redirects should behave. Laravel Cloud then writes the DNS records the environment needs and issues an SSL certificate. There are no records for you to copy, and no verification records to add. Domains hosted on Laravel Cloud’s DNS point directly at your environment and are not proxied through Cloudflare. A domain can be attached to one environment at a time. To serve another environment from the same domain, attach a subdomain instead, such as staging.example.com. You can create a subdomain when you connect it to an environment, or from the domain’s Subdomains tab, where a subdomain can also redirect to another address instead of serving an environment. Laravel Cloud will not attach a domain when:
  • The root domain, www, or the wildcard name already has an A or CNAME record that you created. Delete the record from the domain’s DNS records, then connect the domain again.
  • The environment is served by its own load balancer. Add the domain as a custom domain and create its records manually instead.
  • The domain’s nameservers no longer point at Laravel Cloud.
To change a root domain’s wildcard or www redirect settings after attaching it, detach the domain and attach it again.

Manage DNS records

Each domain hosted by Laravel Cloud has a DNS records section in its details panel. Open the domain on the Domains page to create, edit, and delete A, AAAA, CNAME, MX, TXT, SRV, and CAA records, including records that have nothing to do with Laravel Cloud, such as those used by your email provider or for third-party domain verification. A CNAME record cannot be created at the root of the domain.

Time to live

Each record has a time to live (TTL), which controls how long resolvers cache the record before checking for a new value. If you leave the TTL empty, the record uses five minutes. Use a short TTL, such as one or five minutes, ahead of a planned change so the new value is picked up quickly. Use a longer TTL, such as one day, for records that rarely change, such as MX records.

Cloud-managed records

Laravel Cloud creates and maintains the records that route traffic to your environments and keep their SSL certificates valid. These records are marked with a lock icon in the record editor and cannot be edited or deleted, since changing them would take your application offline. You also cannot create a record that conflicts with a Cloud-managed record. Laravel Cloud updates its managed records when you attach the domain to an environment or detach it. To remove a Cloud-managed record, detach the related domain or subdomain from its environment.

Moving DNS away from Laravel Cloud

You can move a domain’s DNS to another provider at any time. Before you do, recreate the domain’s records at the new provider, including the records your environments need. Your environment’s domain settings show the records required to keep a custom domain connected when DNS is hosted elsewhere. Once the records are in place, update the domain’s nameservers. For a domain registered elsewhere, update the nameservers at its registrar. For a domain registered through Laravel Cloud, open the domain on the Domains page and replace the nameservers in its Nameservers section. A domain needs between 2 and 13 nameservers. Select Reset nameservers to point the domain back at Laravel Cloud. Laravel Cloud checks every hour that each domain still points at its nameservers. When the nameservers change, Cloud emails you, marks the domain as Nameservers changed, and keeps serving the domain’s records so resolvers that cached Cloud’s nameservers keep working. Resolvers may cache Cloud’s nameservers for up to 48 hours. Deleting a delegated domain from the Domains page detaches it from its environments and removes its subdomains. Laravel Cloud keeps answering for the domain until none of its nameservers remain at your registrar. If you add the domain again in the same organization, Cloud restores its records.