HTTP

HTTP 428 Precondition Required vs 522 Connection Timed Out

HTTP 428 (Precondition Required) is a 4xx Client Error response, while 522 (Connection Timed Out) is a 5xx Server Error response. 428 indicates that the server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates. In contrast, 522 means that cloudflare-specific. TCP connection to the origin server timed out.

Description

The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

When You See It

When an API requires optimistic concurrency control via ETags.

How to Fix

Fetch the resource first to get its ETag, then include If-Match in your update request.

Description

Cloudflare-specific. TCP connection to the origin server timed out.

When You See It

When the origin server is overloaded or network issues prevent connection.

How to Fix

Check origin server health. Verify firewall rules. Check for network congestion.

Key Differences

1.

428 is a 4xx Client Error response, while 522 is a 5xx Server Error response.

2.

HTTP 428: The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

3.

HTTP 522: Cloudflare-specific. TCP connection to the origin server timed out.

4.

You encounter 428 when when an API requires optimistic concurrency control via ETags.

5.

You encounter 522 when when the origin server is overloaded or network issues prevent connection.

When to Use Which

For 428 (Precondition Required): Fetch the resource first to get its ETag, then include If-Match in your update request. For 522 (Connection Timed Out): Check origin server health. Verify firewall rules. Check for network congestion.

Learn More