Connecting DigitalOcean App Platform with Cloudflare involves several steps to ensure that your domain is properly routed through Cloudflare’s content delivery network (CDN) and security services. Here’s a step-by-step guide.
-
Set Up Your Domain on Cloudflare:
-
Sign Up/Log In to Cloudflare:
- Go to Cloudflare and sign up for an account or log in if you already have one.
-
Add Your Domain:
- In the Cloudflare dashboard, click on “Add a Site” and enter your domain name.
- Cloudflare will begin scanning your domain’s DNS records. Wait for this process to complete.
-
Review DNS Records:
- Cloudflare will display the DNS records it found for your domain. Verify that these records are correct. You can add or remove records as needed.
-
Change Your Domain’s Nameservers:
- Cloudflare will provide you with two nameservers. You need to change your domain’s nameservers to these Cloudflare nameservers. This is usually done through your domain registrar’s website (where you purchased your domain).
-
Sign Up/Log In to Cloudflare:
-
Configure DNS Records in Cloudflare for DigitalOcean App Platform
-
Obtain DigitalOcean App Platform Information:
- In your DigitalOcean App Platform dashboard, find the necessary information for your app’s custom domain setup, typically including the hostname and target (CNAME or A record).
-
Add DNS Records in Cloudflare:
- Go to the DNS section of your Cloudflare dashboard for your domain.
-
Add a new DNS record:
-
Type:
Choose CNAME if DigitalOcean provided a
CNAME
record, orA
if an IP address was provided. -
Name:
Enter the subdomain you want to use (e.g.,
www or @
for the root domain). - Target: Enter the value provided by DigitalOcean (either a URL or an IP address).
- Proxy status: Set to “Proxied” (the orange cloud icon) to enable Cloudflare’s CDN and security features.
-
Type:
Choose CNAME if DigitalOcean provided a
-
Verify Your Setup:
- Ensure all necessary records are added and that they match the instructions provided by DigitalOcean.
-
Obtain DigitalOcean App Platform Information:
-
Configure SSL/TLS Settings:
-
SSL/TLS Mode:
- Go to the SSL/TLS section in Cloudflare.
- Choose the appropriate SSL mode (e.g., Flexible, Full, Full (strict)) depending on how SSL is set up on your DigitalOcean app. For full encryption, Full (strict) is recommended, but your app must support it.
-
Edge Certificates:
- Ensure that Cloudflare’s Universal SSL is enabled for your domain. This provides SSL termination at the Cloudflare edge servers.
-
SSL/TLS Mode:
-
Verify and Test Your Setup
-
Propagation:
- Allow some time for DNS changes to propagate. This can take up to 48 hours, but usually, it’s much quicker.
-
Testing:
- Test your domain in a browser to ensure it’s loading correctly through Cloudflare.
- Use tools like WhatsMyDNS to check DNS propagation status.
- Verify SSL by checking the padlock icon in the browser and by using SSL checking tools like SSL Labs.
-
Propagation:
By following these steps, you should have successfully connected your DigitalOcean App Platform app with Cloudflare. This setup leverages Cloudflare’s powerful CDN and security features while pointing your domain to your DigitalOcean-hosted application. Make sure to monitor your site and check for any potential issues that may arise during the DNS propagation period.