SSL 521 error: Cloudflare a-record pointing to DigitalOcean droplet

I have read many posts about this issue but I am still having issue.

Client is using Cloudflare, Full SSL for their website. I have a ubuntu digitalocean droplet with a web-app that needs SSL. I have created the a-record WEBAPP in Cloudflare pointing to the IP of my digitalocean droplet. So, should answer at digitalocean with HTTPS. Note: http works fine.

I have confirmed firewall is accepted https and 443 is open.

I read documentation about adding a cert to the droplet but Let Encrypt says I need nameservers pointing to DigitalOcean. **Is this a requirement? I would prefer to not have to move the nameservers since the only thing on digitalocean is this one app.

What I am missing here? Thanks!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Did you try to diagnose the problem with ? Can you give us a test result from there, please ?

Site Moderator
Site Moderator badge
April 7, 2023


I assume that you’re using a CDN service like CloudFlare. The 521 error will usually occur when there is CDN enabled and it will indicate an issue between your local machine and the server or between the CDN and the server itself.

What I usually recommend is to temporarily disable the CDN in order to determine if the issue lies on the droplet, e.g issue with the web-server (Apache/Nginx) or it is DNS related, or some other issue with the CDN.

Error 521 can also occurs when the origin web server refuses connections from Cloudflare. Security solutions at your origin may block legitimate connections from certain Cloudflare IP addresses.

You can also make sure that port 443 is open with this command:

  1. iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

Also, you can check our tutorial for whitelisting IPs with iptables:

If you’re using CloudFlare you can check this post from their community:


This comment has been deleted

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel