Mapping DigitalOcean App Platform Endpoints with DNS Aliases
Mapping DigitalOcean App Platform endpoints with DNS aliases allows you to route custom domain traffic directly to your cloud applications without exposing underlying IP addresses. By configuring a CNAME record or an ALIAS/ANAME record at your DNS provider, you bridge your public domain name with the default .ondigitalocean.app endpoint assigned to your app component. This process ensures your users can access your web apps via clean, branded URLs while maintaining seamless backend scaling and load balancing.
Understanding DigitalOcean App Platform Endpoints
When you deploy an application to the DigitalOcean App Platform, the system automatically assigns a default endpoint ending in ondigitalocean.app. While this URL is functional for testing, production environments require custom domains. DigitalOcean routes incoming traffic through its edge network, which terminates TLS and forwards requests to your containers or static sites.
To point your own domain to this infrastructure, you cannot simply use an A record with a static IP address. DigitalOcean's architecture uses dynamic load balancers whose IP addresses can change. Instead, you must use DNS alias mechanisms—specifically CNAME records for subdomains and ALIAS or ANAME records (or Cloudflare-specific flattening features) for apex domains like example.com.
Before you start updating your DNS records, it is best to verify your current configuration state using the CNAME Lookup tool on XiaTools to confirm existing pointer targets and troubleshoot propagation delays.
Step-by-Step Guide: Adding a Custom Domain in DigitalOcean
To map your DNS aliases successfully, you must first register the domain inside your DigitalOcean control panel so their edge routers know how to handle incoming HTTP Host headers for your app.
Step 1: Configure the Domain in the Dashboard
- Log in to your DigitalOcean account and navigate to the App Platform section.
- Select your application from the list of deployed projects.
- Click on the Settings tab at the top of the app dashboard.
- Locate the Domains section and click the Edit or Add Domain button.
- Enter your fully qualified domain name (e.g.,
app.example.comorexample.com) and click Save.
DigitalOcean will provide you with the target CNAME value you need to configure at your DNS host. This target typically looks like your-app-name-rand.ondigitalocean.app or points to a regional ingress balancer.
Configuring DNS Alias Records
Once DigitalOcean recognizes your domain, you must create the corresponding DNS records at your domain registrar or external DNS provider (such as Cloudflare, AWS Route 53, or Namecheap). Note that specific menu paths and terminology may differ slightly depending on your provider.
Configuring a Subdomain (CNAME Record)
For subdomains like app.example.com, standard CNAME records are fully supported across all DNS providers.
- Log into your DNS provider's management console.
- Navigate to the DNS zone editor for
example.com. - Create a new record with the following parameters:
- Type:
CNAME - Name / Host:
app - Value / Target:
your-app-name-rand.ondigitalocean.app - TTL:
3600(or Automatic)
- Type:
- Save the record.
Configuring an Apex Domain (ALIAS, ANAME, or Flattening)
DNS standards traditionally forbid CNAME records on root or apex domains (e.g., example.com). To map an apex domain to your App Platform endpoint, use your provider's proprietary root-level alias feature.
- Cloudflare: Use a standard CNAME record for
@. Cloudflare automatically applies "CNAME Flattening" to resolve it. - AWS Route 53: Create an A record, toggle Alias to Yes, and select the target or paste your App Platform endpoint.
- Other Providers (DigitalOcean DNS, DNSimple, etc.): Create an
ALIASorANAMErecord pointing@to yourondigitalocean.apptarget.
Verifying Your DNS Mapping
After creating your DNS records, you must verify that the resolution works correctly and points to the right target. You can use command-line diagnostic utilities to inspect the DNS propagation.
Using Dig
Run the following command in your terminal to check the CNAME chain:
dig app.example.com CNAME +noall +answer
Expected output:
app.example.com. 300 IN CNAME your-app-name-rand.ondigitalocean.app.
Using Nslookup
On Windows PowerShell or standard Unix shells, use nslookup:
nslookup -type=CNAME app.example.com
Troubleshooting SSL/TLS and Connectivity
DigitalOcean automatically provisions free Let's Encrypt SSL certificates for custom domains added to the App Platform, provided your DNS records resolve correctly. If your app returns certificate errors or fails to load, check for these common issues:
| Issue | Cause | Solution |
|---|---|---|
| DNS Propagation Delay | Global DNS servers have not updated yet. | Wait up to 30 minutes, or flush your local DNS cache using ipconfig /flushdns or sudo systemctl restart systemd-resolved. |
| Invalid CNAME Target | Typo in the ondigitalocean.app target string. |
Review your DigitalOcean dashboard settings and ensure the target string matches exactly without trailing periods. |
| Proxy / CDN Interference | Cloudflare orange-cloud proxy is active without SSL mode set to Full/Strict. | Set Cloudflare proxy to DNS-only during initial validation, or configure SSL/Strict mode in Cloudflare dashboard. |
To test your HTTPS connection and inspect the SSL certificate presented by DigitalOcean's edge, run this curl command:
curl -Iv https://app.example.com
Checklist for Mapping App Platform Endpoints
- Added the custom domain in the DigitalOcean App Platform settings.
- Copied the exact
ondigitalocean.apptarget string. - Created a CNAME record for subdomains or an ALIAS/ANAME/Flattened record for apex domains.
- Verified record propagation using
digor an online DNS lookup tool. - Confirmed automatic TLS certificate generation and HTTPS accessibility.