Other 5xx codes
All HTTP status codes in ASP.NET Core
5xx Server error
Not a standard code. Cloudflare sends it when the origin server returns an empty, unknown or unexpected response. Common causes: the origin app crashed or reset the connection, a firewall blocks Cloudflare's IP ranges, or the response headers exceed 128 KB (often too many cookies).
In ASP.NET Core: Your ASP.NET Core app never sends it. Check the app and reverse-proxy logs for crashes or dropped connections at the time of the error, and the size of your cookies.
The StatusCodes constant, HttpStatusCode enum name, reason phrase, class, and how EnsureSuccessStatusCode() and the standard resilience handler treat 520.
| Constant | none |
|---|---|
| HttpStatusCode | none; use (HttpStatusCode)520 |
| Reason phrase | Kestrel sends none; HttpClient's ReasonPhrase is null; common name: Web Server Returned an Unknown Error |
| Class | 5xx, server error |
| IsSuccessStatusCode | false |
| EnsureSuccessStatusCode() | throws HttpRequestException: Response status code does not indicate success: 520. |
| Standard resilience handler | retries it (treated as transient) |
Results.StatusCode(520)
Results.Problem(statusCode: 520, detail: "...")StatusCode(520)
Problem(statusCode: 520, detail: "...")What Results.Problem(statusCode: 520) sends (with AddProblemDetails()), as application/problem+json:
{
"status": 520,
"traceId": "0HNA1B2C3D4E5:00000001"
}A controller's Problem(statusCode: 520) sends the same body.
A bare StatusCode(520) in an [ApiController] also gets a ProblemDetails body automatically; Results.StatusCode(520) in a minimal API sends an empty body unless you add UseStatusCodePages().
Every response on this page was recorded from ASP.NET Core 10.0.12 on Kestrel in the Production environment; the HttpClient rows come from .NET 10.0.12 and Microsoft.Extensions.Http.Resilience 10.10.0.
All HTTP status codes in ASP.NET Core