A 520 error

I am facing the same issue recently.

you can add the following to the sites .htaccees file to stop HTTP/2:-

RewriteCond %{SERVER_PROTOCOL} ^HTTP/2.0$ [NC]
RewriteRule . [F,L]


Header unset Upgrade

same issue to me recently

How is it now? I am facing the similar issue recently.

you can add the following to the sites .htaccees file to stop HTTP/2:-

RewriteCond %{SERVER_PROTOCOL} ^HTTP/2.0$ [NC]
RewriteRule . [F,L]


Header unset Upgrade

I reported a similar problem in Random 520 errors. Here’s how you check if your origin server has HTTP/2 enabled:

curl -I https://www.example.com -s | grep HTTP

I just installed a Centos 7 server this morning and HTTP/2 isn’t enabled by default. This how-to looks somewhat dated, but covers how to set it up: Setting up HTTP/2 on Apache to improve web performance | Tune The Web.

I haven’t done so, but it looks like checking httpd.conf for LoadModule http2_module modules/mod_http2.so will tell you if it’s enabled. A similar point is made in https://httpd.apache.org/docs/2.4/mod/mod_http2.html:

You must enable HTTP/2 via Protocols in order to use the functionality described in this document.

That’s not going to show you origin headers if that hostname is proxied through Cloudflare.

@sdayman Agreed! What I suggested was running the command on the origin server so you’ll get its HTTP protocol. If you run it outside of the origin server, you’ll get Cloudflare’s proxy setting (HTTP/2 in all the cases I’ve seen).

Even the origin server should resolve to the public IP address. Though I can see some configurations where there’s a local DNS it may use. The surefire way to do this would be:
curl -I https://example.com --connect-to :: with the origin IP address.

Hi @chirng,

Due to the number of 520s being reported in similar circumstances, we are escalating the issue to Cloudflare Support. The original incident should have been resolved and your issue may well be unrelated.

We recommend checking these troubleshooting tips, if you haven’t already.

If you have been through these thoroughly and are not seeing corresponding issues on your network/server and you have a ticket number with Cloudflare, please reply and post that #.

To enable efficient troubleshooting by support, please ensure you include the following on the ticket:

  • example URL(s) where you are seeing the error
  • Ray IDs from the 520 pages
  • output from a traceroute from any impacted user
  • output of example.com/cdn-cgi/trace - replace example.com with the affected domain.
  • Also include two HAR file(s) : one detailing your request with Cloudflare enabled on your website and the other with Cloudflare temporarily disabled - see How do I temporarily deactivate Cloudflare ?

So as part of https://community.cloudflare.com/t/random-520-errors/ we fixed an issue with origins silently ending a keepalive connection that was causing very rare 520 errors.

Thus we recommend testing again - if you still see 520s - make sure you follow the guidance in our community tip here:

Unfortunately, I still get 520 errors…

@rob.de.ruiter in your case, you’ll need to follow the standard advice for 520s to unravel it - the origin error logs are the most common source of explaining why Cloudflare encounters an error when fetching from your origin, but the community tip linked to above expands on that.

Error 520: web server returns an unknown error

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 grey cloud the DNS record 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 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

520 errors are prevalent with certain PHP applications that crash the origin web server.

If 520 errors continue after contacting your hosting provider or site administrator, provide the following information to Cloudflare Support: