HTTP Error Codes and Other Server Responses
Key Terms
• Client: A user's device that has an internet connection.
• Server: A specific computer that stores all of a website's data and system files.
What are HTTP Status Codes and Why are they Important?
HTTP status codes are three-digit numbers that are used by a server to give information to the client about the status of a request. Developers use them to identify and fix problems, as well as monitor how information is exchanged between clients and servers.
Understanding HTTP status codes helps developers and website administrators to troubleshoot problems with their website more quickly and efficiently, as well as better understand how information is exchanged between the client and the server. Knowing about them increases the overall professionalism of web development and the awareness of anyone who is simply curious about the errors they have encountered on websites.
Some of the codes below will be familiar to you, but there are probably a few that you have never heard of.
Server Response Categories
1xx – Informational
2xx – Successful Responses
3xx – Redirects
4xx – Client Errors
5xx – Server Errors
Informational
This group is responsible for transferring data. Codes of this type indicate that the request has been received by the server and is being processed. Most often refers to informational messages and is not an error.
• 100 Continue: A provisional response code that indicates that the request has begun to be received and is continuing to be processed.
• 101 Switching Protocols: The server is switching protocols.
• 102 Processing: The request is being processed, but the response is not yet ready.
Successful Responses
Codes in this group indicate that the request was received and successfully processed by the server.
• 200 OK: The request was successful.
• 201 Created: The request created a new resource.
• 202 Accepted: The request has been accepted but not yet processed.
• 204 No Content: The request was successful but does not return any content.
Redirects
This group indicates that the user is being redirected. These codes are informational and are not errors.
• 301 Moved Permanently: The resource has been permanently moved to a new URL.
• 302 Found: The resource has been temporarily moved to a new URL.
• 303 See Other: The response is located at a different URL.
• 304 Not Modified: The resource has not been modified since the last request.
• 307 Temporary Redirect: The resource has been temporarily redirected to a different URL.
Client Errors
The status codes in this group indicate client errors where the server cannot produce the result requested.
• 400 Bad Request: The request is invalid or cannot be processed.
• 401 Unauthorized: The client is not authorized to access the resource.
• 403 Forbidden: The client does not have permission to access the resource.
• 404 Not Found: The client successfully communicated with the server, but the requested data was not found.
• 405 Method Not Allowed: The requested method is not supported for the given resource.
• 406 Not Acceptable: The content requested by the user cannot be recognized. Reasons may be in the encoding or format of the object.
• 408 Request Timeout: The request timed out.
• 410 Gone: The requested resource has been removed.
• 413 Payload Too Large: The size of the request exceeds the maximum allowable size.
• 414 URI Too Long: The server cannot process the request because the requested URL is too long.
• 415 Unsupported Media Type: The server does not support the media type specified in the request.
• 422 Unprocessable Entity: The server has accepted and recognized the request, but cannot process it due to a logical error.
• 429 Too Many Requests: The client has sent too many requests within a certain period of time.
Server Errors
This group includes error codes from the server side, when for some reason it is unable to process the request or perform the required operation.
• 500 Internal Server Error: An internal error has occurred on the server.
• 501 Not Implemented: The server cannot recognize the request because it is not supported.
• 502 Bad Gateway: The server received an invalid response from another server that it uses as a gateway.
• 503 Service Unavailable: The server is temporarily unavailable.
• 504 Gateway Timeout: The server did not receive a timely response from another server that it uses as a gateway.