HTTP

HTTP 405 Method Not Allowed vs 520 Web Server Returned an Unknown Error

HTTP 405 (Method Not Allowed) is a 4xx Client Error response, while 520 (Web Server Returned an Unknown Error) is a 5xx Server Error response. 405 indicates that the HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods. In contrast, 520 means that cloudflare-specific. The origin server returned an unexpected response that Cloudflare could not process.

Description

The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.

When You See It

When sending POST to a read-only endpoint, or DELETE to a non-deletable resource.

How to Fix

Check the Allow response header for supported methods. Use the correct HTTP method.

Description

Cloudflare-specific. The origin server returned an unexpected response that Cloudflare could not process.

When You See It

When Cloudflare receives an empty, unknown, or malformed response from the origin.

How to Fix

Check origin server logs. Ensure responses include proper headers. Verify SSL configuration.

Key Differences

1.

405 is a 4xx Client Error response, while 520 is a 5xx Server Error response.

2.

HTTP 405: The HTTP method is not allowed for the requested resource. The response includes an Allow header listing valid methods.

3.

HTTP 520: Cloudflare-specific. The origin server returned an unexpected response that Cloudflare could not process.

4.

You encounter 405 when when sending POST to a read-only endpoint, or DELETE to a non-deletable resource.

5.

You encounter 520 when when Cloudflare receives an empty, unknown, or malformed response from the origin.

When to Use Which

For 405 (Method Not Allowed): Check the Allow response header for supported methods. Use the correct HTTP method. For 520 (Web Server Returned an Unknown Error): Check origin server logs. Ensure responses include proper headers. Verify SSL configuration.

Learn More