Error 520 on some URLs

Anyone facing 520 errors? I’ve been experiencing 520 errors on different domains starting today without any update or configuration. It started happening suddenly. The same feature/application hosted on the same server under the same settings works on a domain and returns 520 on another domain. No error logs on the server though.

Could it be a Cloudflare issue? I checked cloudflarestatus.com but it says all systems are operational.

Hello, have you followed these troubleshooting steps?

Error 520: web server returns an unknown error

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

Resolution

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:

Typically not (unless it’s Error 500: Internal server error)

I already did this step.

Reviewing the log files on the origin around the time stamp on the HAR file, the origin returns 200 OK while HAR shows Error 520. No error on the origin server logs.

I was able to resolve this issue. It was caused by this header which appears to be prohibited in HTTP/2.

Response.AppendHeader("Keep-Alive", "timeout=3, max=993");

The weird thing is that it works on some domains and gives error 520 on other domains on the same server served via Cloudflare under the same conditions.

That was the confusing part.

[Update]

I realized that the Free Plan domains were the only domains with this issue. All Pro Plan domains are still working properly despite not removing the above header.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.