The Hypertext Transfer Protocol (HTTP) is the foundation of data communication on the World Wide Web. When interacting with web servers, you may encounter various HTTP (error) code numbers that indicate issues in the communication between your browser and the server. These codes provide valuable information about what went wrong and help in troubleshooting the problem. In this article, we will explore some common HTTP error numbers, their meanings, and their underlying causes.
1xx Informational
1xx informational status codes are not considered errors but rather provide information about the ongoing request. They indicate that the server has received the request and is continuing with the process. Examples include:
- 100 Continue: The server has received the initial part of the request and awaits further instructions.
- 101 Switching Protocols: The server is changing the protocol being used on the connection, such as switching from HTTP to WebSocket.
2xx Success
2xx status codes indicate successful requests and server responses. These codes inform the client that the request was processed without any issues. Commonly encountered codes include:
- 200 OK: The request has succeeded, and the server is returning the requested information.
- 201 Created: server has successfully fulfilled the request and created a new resource as a result.
- 204 No Content: The server successfully processed the request but has no content to return.
- 206 Partial Content: server has fulfilled a partial GET request, returning only a specific portion of the requested resource.
3xx Redirection
3xx status codes inform the client that additional steps need to be taken to complete the request. These codes indicate that the resource requested is located elsewhere. Some notable 3xx codes are:
- 301 Moved Permanently: The requested resource has permanently moved to a new location.
- 302 Found: The requested resource is temporarily located at a different URL.
- 304 Not Modified: The client’s cached version of the requested resource is still valid, and there is no need to transfer the same content again.
- 307 Temporary Redirect: The requested resource is temporarily located at a different URL.
- 308 Permanent Redirect: Similar to above, but permanent.
4xx Client Errors
4xx status codes indicate that there was an issue with the client’s request. These errors are typically caused by the client’s actions or configuration. Common 4xx codes and their causes include:
- 400 Bad Request: The server couldn’t understand the client’s request, often due to malformed syntax or missing information.
- 401 Unauthorized: Meaning the request requires authentication, and the client either failed to provide valid credentials or lacks authorization to access the requested resource.
- 402 Payment Required: Reserved for future use. It signifies that payment is required to access the requested resource.
- 403 Forbidden: The server refuses to fulfill the request, indicating that the client does not have sufficient permissions to access the requested resource.
- 404 Not Found: Server cannot find the requested resource. This is one of the most commonly encountered HTTP errors and typically occurs when a URL or page is invalid or has been removed.
- 405 Method Not Allowed: The requested method (e.g., GET, POST, PUT) is not allowed for the specified resource.
- 406 Not Acceptable: Server can’t respond with the requested content type(s) specified in the request’s “Accept” header.
- 408 Request Timeout: Terminated request, by the server, because the client failed to send a complete request within the specified time.
- 429 Too Many Requests: The user has sent too many requests in a given amount of time, exceeding the server’s rate limit.
5xx Server Errors
5xx status codes indicate that the server encountered an error while processing the request. These errors are caused by issues on the server-side. Common 5xx codes and their causes include:
- 500 Internal Server Error: A generic error message indicating that something went wrong on the server but the server is unable to provide specific details.
- 502 Bad Gateway: server acting as a gateway or proxy received an invalid response from an upstream server.
- 503 Service Unavailable: The server is temporarily unable to handle the request due to maintenance or being overloaded.
- 504 Gateway Timeout: The server acting as a gateway or proxy did not receive a timely response from an upstream server.
These are just a few examples of the most common HTTP code numbers you may encounter. Each code provides valuable insights into the specific situation encountered during communication between the client and server. By understanding these error codes and their causes, you can diagnose issues and take appropriate actions to resolve them.
Read more: HTTP response status codes