For any system or application to function, there must be communication between entities, such as a server and a client. For example, when you search for information using a browser, your input is sent to the server (the sender), and the browser receives a response (the receiver or client).
When working with communication in applications, there’s a protocol involved called the Hypertext Transfer Protocol (HTTP). Hypertext Transfer Protocol is necessary to ensure communication flows as it should, for example, checking whether the request sent from a client to a server was successful, has failed, or encountered a server error.
HTTP status codes notify developers about the outcome of a request. In this article, we’ll be discussing what these codes represent.
HTTP and HTTP Status Code
Hypertext Transfer Protocol is an application layer protocol that transfers information between devices over a network. It defines the protocol that determines how web browsers and servers communicate. HTTP ensures that websites can be accessed and displayed properly.
When a request is sent to a server to process, the server responds with the information requested alongside an HTTP Status Code.
HTTP status codes are three-digit codes that the server sends in response to a client's request (browser or HTTP client) to confirm if the request was successful, unsuccessful, redirected, or encountered an error.
HTTP status codes are commonly used in API calls to indicate what happens during or after a request. They are sent with the API's response to inform the client about the outcome of the request, which determines what to do next.
Understanding HTTP status codes helps diagnose issues during communication, which is necessary to ensure a reliable application and facilitate a seamless user experience.
Other benefits of HTTP status code include;
Transparent Communication Between Client and Server: Status codes provide a way for a server to tell the client the outcome of its request, e.g., success or error
Debugging and Troubleshooting: Status codes make it easy for developers to identify issues quickly.
User Experience: Status code can be used to display error messages to users so they understand why a request isn't processed, e.g., network error
Performance Optimization: Status code can improve performance, for instance, caching systems use status codes like 304 Not Modified to avoid unnecessary transfers.
Types of HTTP Status Codes
There are five classes of HTTP status codes, including;
Informational responses (100 -199): Informational responses show that the request has been received and is being processed.
Successful responses (200 - 299): A Successful response means the request was received, understood, and accepted without issues.
Redirection messages (300 - 399): This indicates further action is needed to complete the request.
Client error responses (400 - 499): Client error response means there are bad syntax within a request or a request cannot be processed by the server. This error occurs on the client side.
Server error responses (500 -599): This means that the server failed to fulfil a valid request.
Status Codes and Their Functions
There are about 500 possible codes, which are divided into 5 categories. Let's touch on the commonly used ones within these ranges;
1xx Informational Status Code

The informational (1xx) status codes are temporary responses for communicating connection status or request in progress before completing a request and sending a response.
Note: These codes were introduced in HTTP/1.1, and older clients using HTTP/1.0 may not understand them.
100 Continue: 100 continue status code informs the client that the first part of the request was received and the server hasn’t rejected it yet.
After the request has been received and processed, the server is set to send a final response
If the client used an Expect: 100-continue header, the 100 response indicates that the server wishes to receive the request; if the client doesn't include this header, it can disregard the 100 continue message.
In other words, if the client doesn't send Expect: 100-continue, the full request is processed by the server immediately. Expect: 100-continue adds an extra handshake so that bandwidth isn't wasted for large requests.
101 Switching Protocols: 101 switching protocols status code means the server understands and is ready to accept the client's request (using the Upgrade header) to switch to a different communication protocol.
The server will only agree to switch protocols when it is advantageous, for example, switching to a newer version of HTTP or a real-time, synchronous protocol when delivering resources that use such features, e.g., Chat applications.
102 Processing Protocols: This is an HTTP response sent by a server to tell the client that there will be a delay before the final HTTP response is sent, and a period will pass before the final response is received.
This code was used in WebDAV (an extension of HTTP that allows clients to manage files on servers). It is not commonly used in regular HTTP APIs
103 Early Hints: The 103 Early Hints status code is used with the link header to allow the browser (user agent) begin preloading resources, while the server is still processing the full response.
Successful responses 2xx

2XX status code means the client's request was successful, understood, and accepted.
200 0k: The 200 (OK) status code means the request was processed successfully. When the server responds with 200 OK, the content it returns is determined by the HTTP request method. For example;
GET request: the 200 OK would contain the requested resource, e.g. HTML, JSON, etc
POST request: the 200 OK might contain a confirmation, updated resource, or a success message.
DELETE request: 200 OK response returns confirmation that the resource was deleted.
PUT or POST requests: A 200 OK response confirms that content was successfully created or updated.
201 Created: The 201 "Created" status code means that the request is successful which may lead to creating one or more new resources.
202 Accepted: The 202 Accepted status code means that the request has been accepted but processing hasn’t occurred. The request may be delayed or rejected.
203 Non-Authoritative Information: The 203-status code means that the request was successful, but the content returned has been modified by a transforming proxy, such as a caching proxy.
When a transformation occurs, the status code allows the proxy to inform recipients about the change, which would determine what happens to the content, such as whether it can be trusted.
204 No Content: The 204 No Content status code means the server has successfully fulfilled the request, but there isn’t any content in the response body.
205 Reset Content: The 205 Reset Content status code means the server processed the request and then instructs the user agent (e.g., a form or input field) to reset to its original state.
206 Partial Content: The 206 partial content status code is used to respond to a range request, meaning the server is fulfilling only part of a requested resource when a client asks for a specific part (range) of a file.
Redirection 3xx

The redirection status codes indicate that further actions have to be taken by the user for a request to be processed.
300 Multiple Choices: The 300 Multiple Choice status code means that the requested resource has multiple representations, such as different language versions or file types the client can choose from.
301 Moved Permanently: The 301 Moved Permanently status code means that the resource targeted has been allocated a new URI and future references to the resource should use one of the enclosed URIs.
302 Found: 302 Found means the requested resource has been temporarily moved to a different URL, and the client should follow the new URL provided in the Location header to access it.
However, for subsequent requests, the client should continue to use the original URL. This is commonly used when content is temporarily moved during maintenance.
303 See other: The 303 See Other status code means that the server is redirecting the client to a different resource specified in the Location header. It is often used after form submission to redirect the user to a confirmation or result page.
304 Not Modified: The 304 Not Modified status code means that the server received a conditional GET or HEAD but did not result in a 200 OK response because the condition was not met.
For example, when a user revisits a website, the browser may check with the server to see if a resource such as an image has been updated. If the image hasn’t been updated, the server sends a 304 Not Modified status, telling the browser to use the cached version of the image instead of re-downloading it.
307 Temporary Redirect: The 307 Temporary Redirect status code means that the requested resource is temporarily located at a different URI.
During redirection, which occurs automatically, the user agent must maintain the HTTP method. Because the redirection is temporary, the client should subsequent requests given that the redirect location may change over time.
This status code is used during temporary server maintenance, where the main web API endpoint is temporarily down and requests are redirected to a backup server.
308 Permanent Redirect: The 308 Permanent Redirect status code means that resource requested has been given a new permanent URI, and all future request should use the URI provided in the response.
This status code is typically used when a website permanently changes the structure of its URLs, ensuring that all future requests are directed to the new URL without changing the HTTP method.
Client Error Response 4xx

The 4XX Client Error status codes mean that the client has made a request that the server cannot process. This could be because of wrong request syntax, using unsupported methods, a lack of proper authentication, etc.
400 Bad Request: The 400 Bad Request status code means the server cannot understand or process a request due to incorrect syntax. This occurs when the client sends a malformed request, for example, invalid characters, incorrect formatting, etc.
401 Unauthorized: 401 Unauthorized status code means that the request was rejected due to invalid or missing authentication credentials for the target resource. This occurs when a user provides incorrect login details.
403 Forbidden: 403 Forbidden status code means that the server understood the request but refuses to fulfil it. Even if authentication credentials are provided, the server may consider them insufficient to grant access.
This response is not necessarily about authentication failure; it relates to valid authentication but inadequate authorization. If available, the server may include a message in the response explaining why the request was forbidden.
404 Not Found: The 404 Not Found status code means the server cannot find the requested resource.
405 Method Not Allowed: The 405 Method Not Allowed status code means the HTTP method used in the request is not allowed for the requested resource. For example, a client is trying to use a POST on a resource that requires a GET method.
408 Request Timeout: The 408 Request Timeout status code means that the server timed out while waiting for the client to send a request. It happens when the server does not receive the complete request within its wait time.
409 Conflict: The 409 Conflict status code means the request could not be processed because of its difference with the current state of the requested page.
410 Gone: The 410 Gone status code means that access to the target resource is not available at the main server.
413 Content Too Large: 413 Content Too Large status code means the server cannot process a request because the content is too large for it to handle.
415 Unsupported Media Type: The 415 Unsupported Media status code means the server does not support the request's media format.
421 Misdirected Request: The 421 Misdirected Request status code means the request was sent to the wrong server. This occurs when a connection meant for one server is mistakenly used to send a request to a different server.
429 Too Many Requests: The 429-status code means the client sent multiple requests within a short time.
Server Error 5XX

The 5xx server error status code means the server cannot perform the requested method. The errors are server-side problems, which indicate that a request was valid but the server was unable to process it due to internal issues. Common 5XX status codes include;
500 Internal Server Error: The 500 Internal Server status code means the server faced an unexpected condition that hindered it from fulfilling the request.
501 Not Implemented: The 501 Not Implemented status code means the server does not support the request method required to fulfil the request.
For example, a client sends an HTTP request using a PATCH method to a server that handles methods like GET and POST.
502 Bad Gateway: The 502 Bad Gateway status code means the server, while acting as a gateway or proxy, received an invalid response from an upstream server it accessed in an attempt to fulfil the request.
503 Service Unavailable: The 503 Service Unavailable status code means the server is temporarily unavailable to handle the request due to overload or maintenance.
504 Gateway Timeout: The 504 Gateway Timeout status code means that the server didn't receive a timely response from a different server it needed to contact on time.
505 HTTP Version Not Supported: The 505 HTTP Version Not Supported status code means that the server does not or refuses to support the HTTP protocol version used in the request message.
Summary
Status codes are integral in developing applications; they make communication between client and server possible. They help developers display appropriate messages to users, for example, indicating whether a request was successful, failed due to network issues, or if the server is under maintenance.
Additionally, they assist developers in debugging and improving client and server communication.
Frequently Asked Questions
Does HTTPS expire?
SSL certificates now expire after 13 months, making them invalid and leaving communications unprotected.
How does CSP handle mixed content (HTTP and HTTPS) issues?
CSP can mitigate mixed content issues by blocking or upgrading insecure requests, reducing security vulnerabilities associated with mixed content.
Will HTTPS affect my site performance?
Yes. SSL impacts the site performance since it takes extra round trips to establish a secure connection. But, the increased level of security is worth the wait of a few milliseconds.
What is the advantage of HTTP/2 enabled servers?
HTTP/2 enabled servers offer enhanced performance through faster and more efficient communication between clients and servers, which can significantly improve your Minecraft server's load times and stability.

Jessica Agorye is a developer based in Lagos, Nigeria. A witty creative with a love for life, she is dedicated to sharing insights and inspiring others through her writing. With over 5 years of writing experience, she believes that content is king.
View all posts by Jessica Agorye