In HTTP, status codes are a machine-readable mechanism indicating the result of a previously issued request. From RFC 7231, sec. 6: "The status-code element is a three-digit integer code giving the result of the attempt to understand and satisfy the request."
The formal grammar allows codes to be anything between 000
and 999
. However, only the range from 100
to 599
has assigned meaning.
HTTP/1.1 defines a number of numeric HTTP status codes that appear in the status line - the first line of an HTTP response - to summarise what the client should do with the response.
The first digit of a status codes defines the response’s class:
1xx
Informational2xx
Client request successful3xx
Request redirected - further action necessary, such as a new request4xx
Client error - do not repeat the same request5xx
Server error - maybe try againIn practice, it is not always easy to choose the most appropriate status code.