HTTP 520 with Cloudflare -> DigitalOcean App Platform

What is the name of the domain?

What is the error number?

HTTP 520

What is the error message?

The usual Cloudflare HTTP 520 error page, there are no server-side errors at all.

What is the issue you’re encountering

We have persistent but uncommon HTTP 520 errors that happen. We can see them in the Cloudflare analytics too.

What steps have you taken to resolve the issue?

  • I’ve tried enabling h2c / HTTP 2.0
  • I’ve tried enabling keep alive
  • I’ve tried extending the keep-alive TTL to 75 seconds.
  • I’ve tried disabling keep-alive entirely.
  • I’ve tried variously enabling and disabling HTTP/2 to Origin on my Cloudflare “Speed” settings with combination s of the above.

I’m using DigitalOcean App Platform so I can’t serve the website to DO’s App Platform load balancer as a TLS thing.

What are the steps to reproduce the issue?

If you navigate around the site enough it’ll happen eventually but the frequency is 0.8~1% so it takes awhile.

Screenshot of the error

I tried submitting a support ticket but I can’t log into the support portal. I also submitted a ticket for linking my dashboard account for support portal access but that hasn’t gotten a response yet either.

Hello, Error 520 occurs when the origin server returns an empty, unknown, or unexpected response to Cloudflare.

A quick workaround while further investigating 520 errors is to either make the record DNS-only in the Cloudflare DNS app or temporarily pause Cloudflare.

Contact your hosting provider or site administrator and request a review of your origin web server error logs for crashes and to check for these common causes:

  • Origin web server application crashes
  • Cloudflare IPs :arrow_upper_right: not allowed at your origin
  • Headers exceeding 16 KB (typically due to too many cookies)
  • An empty response from the origin web server that lacks an HTTP status code or response body
  • Missing response headers or origin web server not returning proper HTTP error responses :arrow_upper_right:.

HTTP 520 on Cloudflare appears to happen for any number of reasons, not all of them enumerated in the copy-and-paste reply you’ve given me here.

Here’s an example ray id: 8e873f95bbffb034

They include:

I don’t have errors in my application. There are no error logs, I aggregate and search with LogTail.

I’ve tested it and it only repros when we access our website via Cloudflare regardless of how our application server is configured (HTTP/2 yes/no, KeepAlive yes/no, HTTP/2 to Origin yes/no)

Our web servers are hosted with DigitalOcean, who themselves use Cloudflare as part of their App Platform offering as a CDN, so I would have to believe that you aren’t blocking your own edge servers.

It’s an intermittent issue, accounts for 1% or so of requests. But it does persist.

As near as I can tell there’s some issue with how DigitalOcean’s Cloudflare substrate is configured and I have to move my website off of DigitalOcean or take my website off the paid Cloudflare account I’ve setup.

However, I’d rather y’all tell me what’s going on and how to fix it.

This topic was automatically closed after 15 days. New replies are no longer allowed.