4xx Client Error

Overview

4xx codes generally are error responses specifying an issue at the client’s end. Potentially a network issue.  

  • Can be used as a response to any request method
  • Origin server should include an explanation and the explanation which should be displayed by User-Agent, with the exception of a HEAD request

Cloudflare will pass these errors directly from your origin

400 Bad Request  (RFC7231)

Server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

401 Unauthorized (RFC 7235)

Request was not sent with the proper authentication credentials

  • Server must send with at least one challenge in the form of a WWW-Authenticate header field according to Section 4.1
  • Client may send a second request with same credentials and then if the challenge is identical to the one before, an entity will be provided by the server to help the client find what credentials are needed.

402 Payment Required (RFC7231)

Not yet implemented by RFC standards, but reserved for future use

403 Forbidden (RFC7231)

Refusal to serve an authorized request. Server is explicitly telling the client that the request was forbidden. This may not only be because of invalid credentials but also maybe for reasons the server does not wish to expose.

  • Server  may include description of was the request was unauthorized in the payload
  • Client should not repeat the identical request again
  • Servers may also choose to use 404 if wishing to conceal the resource exists

Cloudflare will serve 403 responses if the request violated either a default WAF rule enabled for all orange-clouded Cloudflare domains or a WAF rule enabled for that particular zone. Read more at What does the Web Application Firewall do?

Cloudflare will also serve a 403 Forbidden response for SSL connections to sub/domains that aren't covered by any Cloudflare or uploaded SSL certificate.

404 Not Found (RFC7231)

Origin server was unable or unwilling to find the resource requested. This usually means the host server could not find the resource. To serve a more permanent version of this error one should use a 410 error code.

Website owners usually implement a custom page to be served when this error is generated. For example, Implementing Custom 404 pages in Apache.

Cloudflare does not generate 404s for customer websites, we only proxy the request on from the origin server. When seeing a 404 for your Cloudflare powered site you should contact your hosting provider for help.

 

405 Method Not Allowed (RFC7231)

Origin server is aware of the requested resource, but the request method used is not supported.

  • Origin server must also provide an Allow header with a list of supported targets for that resource.

An example would be a POST on an unchangeable resource the thus only accepts GET.

406 Not Acceptable (RFC7231)

Resource is not available at the origin that adheres to negotiation headers that were  set prior (e.g. via Accept-Charset and Accept-Language headers)

This status code can be replaced by simply serving the less preferred method to the User-Agent in lieu of generating this error.

407 Authentication Required  (RFC 7235)

The client did not send the required authentication with the request.

408 Request Timeout  (RFC7231)

The origin server did not receive the complete request in what it considers a reasonable time.

  • Implied the server does not wish to wait and continue the connection.
  • Not used much because servers typically choose to use the “close” connection option.

 

409 Conflict (RFC7231)

The request did not complete because of a conflict with the current state of the resource. Typically happens on a PUT request where multiple clients are attempting to edit the same resource.

  • The server should generate a payload that includes enough information for the client to recognize the source of the conflict.
  • Clients can and should retry the request again

Cloudflare will generate and serve a 409 response for a Error 1001: DNS Resolution Error.

410 Gone (RFC7231)

The resource requested is permanently missing at the origin.

  • The server is suggesting the links reference the resource should be removed.
  • The server is not qualified to use this status code over a 404 response nor required to have this response for any specific period of time.

411 Length Required (RFC7231)

Client did not define the Content-Length of the request body in the headers and this is required to obtain the resource.

  • Client may resend the request after adding the header field.

412 Precondition Failed  (RFC 7232)

Server denies the request because the resource failed to meet the conditions specified by the client.

For example of version control, a client is modifying an existing resource and thus sets the If-Unmodified-Since header to match the date that the client downloaded the resource and began edits. If the resource was edited (likely by another client) after this date and before the upload of the edits, this response will be generated since the date of the last edit will come after the date set in If-Unmodified-Since by the client.

Cloudflare will serve this response. For more information see: ETag Headers

413 Payload Too Large  (RFC7231)

Refusal from the server to process the request because the payload sent from the client is larger than the server wished to accept. Server has the optional to close the connection.

  • If this refusal would only happen temporarily, then the server should send a Retry-After header to specify when the client should try the request again.

414 URI Too Long (RFC7231)

Refusal from the server that the URI was too long to be processed. For example, if a client is attempting a GET request with an unusually long URI after a POST, this could be seen as a security risk and a 414 gets generated.

Cloudflare will generate this response for a URI longer than 32KB

415 Unsupported Media Type (RFC7231)

Refusal from the server to process the format of the current payload. One way to identify and fix this issue would be to look at the Content-Type or Content-Encoding headers sent in the client’s request.

417 Expectation Failed (RFC7231)

Failure of server to meet the requirements specified in the Expect header of the client’s request.

429 Too Many Requests (RFC6585)

Client has sent too many requests in the specified amount of time according to the server. Often known as "rate-limiting". Server may respond with information allowing the requester to retry after a specific period of time.

Cloudflare will generate and send this status code when a request is being rate limited. If visitors to your site are receiving these error codes, you will be able to see this in the Rate Limiting Analytics.

451 Unavailable For Legal Reason (RFC7725)

Server is unable to deliver the resource due to legal actions.

Typically search engines (e.g. Google) and ISP (e.g. ATT) are the ones affected by this response code and not the origin server.

  • The response should include an explanation is the response body with details of the legal demand.

499 Client Close Request

Nginx specific response code to indicate when the connection has been closed by the client while the server is still processing its request, making server unable to send a status code back.

Still not finding what you need?

The Cloudflare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.

Powered by Zendesk