How to Add a Custom Domain to DigitalOcean App Platform
Log into DigitalOcean, navigate to your app's Settings > Domains > Edit > Add Domain, then choose between delegating DNS to DigitalOcean (update nameservers) or managing DNS yourself (add a CNAME record). DNS propagation typically takes 1-72 hours depending on your method.
Prerequisites
- Active DigitalOcean account with billing enabled
- Deployed app on DigitalOcean App Platform
- Ownership of a custom domain from any registrar
- Access to your domain registrar or DNS provider control panel
Step-by-Step Instructions
Access Your DigitalOcean App Settings
Log into your DigitalOcean Cloud Control Panel and navigate to the App Platform section. Select the specific app you want to configure with a custom domain. Once the app dashboard opens, click the Settings tab at the top to access app configuration options.
Navigate to the Domains Section
In the Settings tab, scroll down to find the Domains section, which is typically the second section under App Settings. Click the Edit link to the right of the Domains header to enter edit mode.
Click Add Domain Button
In the edit view, click the + Add Domain or Add Domain button. A form will appear with a text field where you can enter your custom domain name. Type your domain or subdomain (for example, www.example.com or api.mycompany.com).
Choose Your DNS Management Method
After entering your domain, two options appear: We manage your domain (DigitalOcean-managed DNS) or You manage your domain (external DNS provider). Your choice depends on where your domain is registered and your preference for DNS management. Select the option that matches your setup before proceeding to the next step.
Option A: Delegate to DigitalOcean Nameservers
If you selected We manage your domain, DigitalOcean will manage all DNS records automatically. However, you must first update your domain's nameservers at your registrar. Log into your domain registrar (such as Namecheap or GoDaddy) and update the nameservers to:
ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.comReturn to DigitalOcean and click Add Domain to confirm. DigitalOcean will automatically create the necessary DNS records for your app.
Option B: Add CNAME Record to External DNS Provider
If you selected You manage your domain, DigitalOcean will provide a CNAME target alias (for example, your-app.ondigitalocean.app). Click the copy button next to this alias. Log into your DNS provider's control panel and add a new CNAME record with the following details:
Type: CNAME Host: www (or your subdomain) Value: your-app.ondigitalocean.app TTL: Default (typically 1 hour)Save the DNS record at your provider, then return to DigitalOcean and click Add Domain to confirm.
Delete Conflicting DNS Records
If you're using the CNAME method, check your DNS provider for any existing A records pointing to old IP addresses. Delete these conflicting records to prevent DNS resolution issues. A records and CNAME records cannot coexist for the same domain, so removing old A records is essential for proper domain routing.
Wait for DNS Propagation
After adding your domain, it will appear in the Domains section with a Pending status. DNS propagation times vary: CNAME records typically propagate within 5-30 minutes, while nameserver changes can take up to 72 hours. During this time, your app may redeploy automatically. You can verify propagation using DNS lookup tools or by checking if your domain resolves to your app.
Verify Domain is Active
Once DNS propagation completes, the domain status in your Settings > Domains section will change from Pending to Active. At this point, your app is accessible via the custom domain. You can test by visiting your domain in a web browser to confirm it loads your DigitalOcean app.
Enable HTTPS (Optional but Recommended)
Once your domain is active, DigitalOcean automatically provisions a free Let's Encrypt SSL certificate for your domain. Check the Settings > Domains section to verify HTTPS status. If you want to force all traffic to use HTTPS, configure this in your app's environment settings or through your app's configuration file.
Common Issues & Troubleshooting
Domain remains in Pending status after 24 hours
Verify your DNS configuration is correct. For nameserver delegation, confirm all three nameservers are updated at your registrar. For CNAME records, ensure the CNAME value exactly matches the DigitalOcean-provided alias and that conflicting A records have been deleted. Use a DNS lookup tool like dig or nslookup to verify propagation.
CNAME record not working with external DNS provider
Ensure you deleted any existing A records for the same domain, as A and CNAME records cannot coexist. Verify the CNAME value is exactly your-app.ondigitalocean.app (copied from DigitalOcean). Check your DNS provider's documentation for CNAME-specific requirements, as some providers have restrictions on CNAME records at the apex domain.
Domain shows Active but app is not accessible
Clear your browser cache and try accessing the domain in an incognito window. Wait a few additional minutes for full DNS propagation. Verify the domain was correctly added in DigitalOcean's Domains section. Check that your app is running and not in a failed deployment state by reviewing the app's deployment logs.
SSL certificate not provisioning for custom domain
Ensure the domain is fully active and DNS is properly configured. DigitalOcean automatically provisions Let's Encrypt certificates, but this requires valid DNS resolution. Wait 5-10 minutes after the domain becomes active. If the certificate still doesn't appear, check the app's deployment logs for SSL provisioning errors.
Nameserver changes not taking effect after 72 hours
Contact your domain registrar to confirm nameserver updates were saved correctly. Some registrars require additional confirmation steps. Verify you entered all three DigitalOcean nameservers exactly: ns1.digitalocean.com, ns2.digitalocean.com, and ns3.digitalocean.com. Use a DNS propagation checker tool to see if nameservers have updated globally.