4xx Client Error Overview
4xx codes are error responses indicating issues on the client's end, often due to network problems. These codes can be used as a response to any request method and usually come with an explanation from the origin server, except for HEAD requests.
- Custom Rules: Can return any response code in the 400 to 499 range if configured by the site owner.
- Significance: Indicates that the client sent a request that could not be understood or processed due to issues with the request itself.
Specific 4xx Status Codes
400 Bad Request
- Causes: Malformed request syntax, invalid content, message framing problems, or deceptive routing (e.g., special characters not URL encoded).
- Resolution: Ensure correct syntax and proper authentication when using Cloudflare API.
401 Unauthorized
- Causes: Client fails to provide valid authentication credentials.
- Resolution: Provide correct authentication credentials and check the
WWW-Authenticate header for guidance.
402 Payment Required
- Reserved for future use and not implemented.
403 Forbidden
- Causes: Insufficient permissions to access a resource; can be due to server configuration or Cloudflare WAF/Security settings.
- Resolution: Check server permission rules and ensure Cloudflare's IPs aren't blocked.
404 Not Found
- Causes: Resource not found due to mistyped URLs, broken links, or removed pages.
- Resolution: Implement a custom 404 page for improved user experience.
405 Method Not Allowed
- Causes: Unsupported HTTP method used in the request.
- Resolution: Verify that the correct methods are enabled on the origin server.
406 Not Acceptable
- Causes: Resource not available in the requested format (e.g., language or charset).
- Resolution: Origin server should serve a less preferred format if possible.
407 Proxy Authentication Required
- Causes: Missing authentication credentials for a proxy server.
- Resolution: Include appropriate
Proxy-Authorization header.
408 Request Timeout
- Causes: Client fails to send a complete request within the server's timeout period.
- Resolution: Check the origin server's timeout settings and client’s connection stability.
409 Conflict
- Causes: Request conflict with the current state of the resource (e.g., simultaneous edits).
- Resolution: Server should provide information to resolve conflict.
410 Gone
- Causes: Resource permanently removed.
- Resolution: Remove links to the resource; contact hosting provider for assistance.
411 Length Required
- Causes: Missing
Content-Length in request headers.
- Resolution: Resend request with the required header.
412 Precondition Failed
- Causes: Resource does not meet conditions set by the client.
- Resolution: Refer to ETag headers and resolve condition issues.
413 Payload Too Large
- Causes: Request payload exceeds server's size limit.
- Resolution: Split requests into smaller chunks or upgrade plan for larger uploads.
414 URI Too Long
- Causes: Excessively long URI.
- Resolution: Simplify the URI.
415 Unsupported Media Type
- Causes: Unsupported payload format.
- Resolution: Check
Content-Type or Content-Encoding headers.
416 Range Not Satisfiable
- Causes: Invalid
Range header in request.
- Resolution: Ensure requested range does not exceed resource bounds.
417 Expectation Failed
- Causes:
Expect header requirements not met.
- Resolution: Avoid unsupported
Expect headers.
429 Too Many Requests
- Causes: Too many requests in a short time frame.
- Resolution: Abide by rate limits and check
Retry-After header.
451 Unavailable For Legal Reasons
- Causes: Legal restrictions blocking resource access.
- Resolution: Check response explanation for details.
499 Client Closed Request
- Causes: Client terminates connection before server response.
- Resolution: Ensure TCP connection is established and timeout settings are appropriate.