White Arrow Pointing To The Left Of The Screen
Blog
By
Alexander Jimenez
|
Related
Content
Back to Blog

The Meaning of HTTP Status Codes

21
Mar
2023

As an online professional, you know that a site's performance can make or break its success. Even the most finely-tuned web pages may sometimes run afoul of dreaded status codes. Grab your coffee (or favorite caffeinated beverage) and dive into the depths of HTTP statuses!

What is an HTTP Status Code?

An HTTP status code is a response returned by a server to state a request's status. These are standard communication systems between users and servers to provide accurate information on the current status of a request, depending on the core issue.

In terms of structure, HTTP statuses have a three-digit format. The first digit determines the response class you get. It tells you whether the issue comes from the server, client, or other sources. As you'll see below, the second and third give specific details on the status request.

Furthermore, there are hundreds of response status codes out there! The main form of classifying them is through classes, and there are five main classes of HTTP Status Codes. While 1xx status responses provides information about the requests, 2xx status codes indicate an appeal was successful, and 3xx codes provide information about redirection. 4xx codes state a client-related submission issue and contrariwise, 5xx status codes show server-related request failures.

For example, "200 OK" is the success code. It states the request was successful, and you could load the content. Further, "203 Non-Authoritative Information" is an example of a successful request. It usually means access restriction to certain content or areas. It'd be for security reasons or because you don't have permission to access them.

What Does Each HTTP Status Code Mean?

HTTP 1 Status Codes: Informational Codes

HTTP 1xx status codes state a provisional informational response from the server while the request processing continues. Here, the server is waiting for something to deliver a complete answer.

 HTTP 100: Continue — It indicates that the server successfully received the original request, so the client should continue. You can assign it when your user needs to send large amounts of data, like uploading images. The server responds with this message when it's ready to receive more info from the client to continue.

● HTTP 101: Protocol — A 101 response means the server doesn't support a current protocol. It usually happens when someone uses a previous protocol version. The 101 message notifies the user to switch to a newer one instead of using previous versions to continue the request.

● HTTP 102: Processing — This provisional response implies that the server has taken over processing, but the processing continues. It's helpful during long-running requests, complex calculations, or database lookups. When a server sends this status code, clients don't need to keep retrying until they get a response message. Instead, they should wait until the processing of all the content finishes.

HTTP 2 Status Codes: Success Codes

2xx HTTP status codes declare that the server received the client's request successfully. This class of status code represents success.

 HTTP 200: OK — This code is the standard response for successful HTTP requests. HTTP 200 indicates that the server received and processed the request successfully.

 HTTP 201: Created — It's used when the user creates, uploads, or adds a newly created resource to a database. Yet, a 201 status response doesn't guarantee the server stored or made available data in any way.

 HTTP 202: Accepted — It indicates that the server accepted the current browser request but has yet to complete it.

 HTTP 203: Non-Authoritative Information — It states that the origin web server returned a valid, timely response. However, the target resource may be at other URLs that could provide better information.

 HTTP 204: No Content — A 204 would indicate no additional content to return, even if the request was successful. So, the response's body will be empty. These status codes provide developers with clear indications of success or failure.

GraphQL and 2xx Status Codes

GraphQL enables devs to send requests and receive data in response. It can still be confusing when using it with response codes. In particular, GraphQL will often return a 2xx (i.e., "successful") status code even if there was an error in the request. It sends a 2xx status code as a generic error message. So even if the request has failed due to some technical issue. GraphQL still returns a successful response within it. These error messages don't indicate what type of failure occurred. By defaulting to a 2xx message, the entire process of finding what went wrong gets difficult. The best way to handle this is for developers to assign the desired status code. Hence, the app can run the specific code it sets. Don't let the 2xx status code cloud your thoughts when working with GraphQL! A 2xx status message is only sometimes a synonym for success.

HTTP 3 Status Codes: Redirection Codes

3xx HTTP codes refer to redirection messages from the server to a different source. Developers use this HTTP location header when they've moved a resource to another URL.

● HTTP 301: Moved Permanently — 301 indicates that the requested URL is no longer available. This code creates an alternative route for all future valid requests to land in a different URL.

● HTTP 302: Found — It indicates that the URL is in another place. Any subsequent requests should still use the original URL.

● HTTP 303: See Other — A 303 status code indicates the controller resource has finished processing the request, but instead of sending an unwanted response, it allows automatic redirection to another source.

● HTTP 304: Not Modified — Developers use HTTP 304 for caching purposes. It usually means that the cached content is still valid. If they modify that content, you won't get a 304 code.

● HTTP 307: Temporary Redirect — It indicates redirecting a specifically requested resource to a different source. Therefore, future requests can still use the original URL.

HTTP 4 Status Codes: Client Errors

All 4xx HTTP error status codes relate to client error responses. This type of response indicates that the server didn't process the browser-side request as expected. Hence, they mean invalid requests.

 HTTP 400: Bad Request — This status appears when the server cannot process the request due to invalid syntax. The code shows if the user has sent data in an unexpected format. For example, if an API requires data in JSON format but receives it in XML.

● HTTP 401: Unauthorized — A user gets a 401 unauthorized response when retrieving a secured resource from the current address. It's normal to get it when not passing user authentication processes properly. Therefore, users need to take additional actions to be appropriately authorized.

● HTTP 403: Forbidden — You'll see a 403 message if you attempt to access the content you cannot view or modify. This status code often needs clarification. Both 401 and 402 indicate a required authentication. However, 401 implies that the user provided the authentication, yet it was insufficient. The second one says that there was no authentication process at all.

● HTTP 404: Not Found — This status code may be one of the most well-known around the web. A 404 occurs when a client attempts to access resources that don't exist on the server and there is no forwarding address set. It happens when a user inputs a URL (dead link) requesting moved or deleted resources.

● HTTP 422: Unprocessable Entity — You can get this status code when the server understands the content type, the request's syntax is correct, yet it was unable to process the request.

● HTTP 451: Unavailable for Legal Reasons — This response appears when a user requests a resource or content removed for legal reasons.

HTTP 5 Status Codes: Server Error Codes

5XX HTTP codes are response messages that result in server error conditions. This server error response indicates that the server is aware of this temporary or permanent condition.

● HTTP 500: Internal Error — A 500 error denotes unexpected issues when processing the user's request.

● HTTP 501: Not Implemented Response — It indicates an issue on the server that prevented it from processing the user's request body.

● HTTP 502: Bad Gateway — It pops up when a gateway server receives an invalid response message from another server.

● HTTP 503: Service Unavailable — It's a server response, which means the server cannot temporarily handle a request. Usually, it's due to maintenance or a temporary overload of resources. Therefore, you'll have to wait for a post request to create another one.

● HTTP 504: Gateway Timeout — 504 shows that the server took longer than expected to process the request.

Why are HTTP Status Codes Important?

HTTP status codes provide valuable insights into the performance of a product. They'll help you find the potential error causes before they become major roadblocks. Most importantly, HTTP errors could prevent Google from indexing your website; after that, you can lose a lot of potential traffic, becoming a problem for SEO.

On the other hand, knowing HTTP status codes will give you a plus. Imagine your app runs a message with some random number, and you're the only one who knows it. It will provide you with enormous importance within the team. 

Final Thoughts

HTTP status three-digit codes are an invaluable tool for developers and Product Owners. Understanding these codes is further essential to ensure user experience. With this article, the next time you see a 5xx error or 2xx success, you'll understand what or where the problem is (if there were one). We hope this article has helped you get the ground based on the types of responses you see on the web. You can now pay attention to them; they are crucial when developing or maintaining products!