520 Web Server Returned an Unknown Error

Cloudflare: the origin returned something unexpected.

Status code
520
Reason phrase
Web Server Returned an Unknown Error
Class
5xx Server errors
Source
Cloudflare (non-standard)

What does 520 Web Server Returned an Unknown Error mean?

Cloudflare-specific: the origin server returned an empty, unknown or invalid response.

Common causes

How to fix it

520 and webhooks

Retried by providers.

Test how your client handles 520

In the webhook tester you can add a response rule that answers 520 — useful to check retries, error handling and alerts before production.

FAQ

What does HTTP 520 mean?

Cloudflare: the origin returned something unexpected. Cloudflare-specific: the origin server returned an empty, unknown or invalid response.

Is 520 an error?

Yes — a server error: the request may succeed if retried later.

Other 5xx codes

500 Internal Server Error · 501 Not Implemented · 502 Bad Gateway · 503 Service Unavailable · 504 Gateway Timeout · 505 HTTP Version Not Supported · 507 Insufficient Storage · 508 Loop Detected · 511 Network Authentication Required · 521 Web Server Is Down · 522 Connection Timed Out · 523 Origin Is Unreachable · 524 A Timeout Occurred · 525 SSL Handshake Failed · 526 Invalid SSL Certificate

← 511   All status codes   521 →

About HTTP 520

520 Web Server Returned an Unknown Error is part of the 5xx class: server errors, where the request may be fine but the server failed.

A 520 is usually safe to retry with exponential backoff; most payment providers retry webhooks that got a 520.

In monitoring, alert on the rate of 520 responses rather than single events, and split by endpoint to find the source.