The ABCs of HTTP Status Codes

Written by
Alexander Jiménez
The ABCs of HTTP Status Codes: What You Need to Know

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. This system provides accurate information depending on the core issue. 

What is the Structure of an HTTP Status Code?

HTTP statuses have a three-digit format structure. 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.

What are the Classes of HTTP Status Codes?

There are hundreds of response status codes out there! The main form of classifying them is through classes. The most common ones are the following:

1xx status responses provide information about the request.
2xx indicates the success of an appeal.
3xx provide information about redirection)
4xx states there was an issue during the submission; the cause is client-related.
5xx server errors indicate a server-related significant request failure.

For example, "200 OK" is the success code. It states the request was successful, and you could load the content. On the other hand, a "403 FORBIDDEN" is an example of a standard error. 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. 

HTTP Status Codes

What are the Most Common HTTP Status Codes?

HTTP 1xx Status Codes: Informational

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

HTTP 100: Continue

It indicates that the server received the 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 will send this message when it's ready to receive more info from the client to continue.

HTTP 101: Protocol

A 101 response means that the server doesn't support its current protocol. It usually happens when someone uses a previous protocol version. The 101 message notifies the user to switch to a newer one to continue the request. 

HTTP 102: Processing 

This message implies that the server has taken over processing the initial request but has yet to finish. 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 their request finishes.

HTTP 2xx Status Codes: Success

2xx HTTP status codes declare that the server successfully received the client's request. An HTTP status code represents this success between 200-299. 

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 new resource to a database. Yet, a 201 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 request but has yet to complete it. 

HTTP 203: Non-Authoritative Info 

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 devs 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 3xx Status Codes: Redirection

3xx HTTP codes refer to the request's redirection from the server to a different source. Devs use these responses when they've moved a different resource 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 

This code redirects users to another source instead of simply returning any content. 

HTTP 304: Not Modified 

Developers use HTTP 304 when 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 4xx Status Codes: Client Errors

All 4xx HTTP error codes relate to client error responses. They indicate that the server didn't process the request as expected.

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 

It's a response that a user gets when retrieving a secured resource. 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 known around the web. A 404 occurs when a client attempts to access resources that don't exist on the server. It happens when a user inputs a URL requesting moved or deleted resources.

HTTP 5xx Status Codes: Server Errors

5XX HTTP codes are response messages that result in server errors. This range of status codes indicates that the server encountered an unexpected 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. 

HTTP 502: Bad Gateway  

It pops up when a gateway server receives an invalid response message from another server. 

HTTP 503: Service Unavailable

It appears when a server temporarily cannot handle a request. Usually, it's due to maintenance or overloaded resources. 

HTTP 504: Gateway Timeout 

504 shows that it took the server longer-than-expected time to process the request.

Why are HTTP Status Codes Important?

HTTP status codes provide valuable insights into the performance of a product. If you're a dev, you need to know their meanings! They'll help you find the potential error causes before they become roadblocks. 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 codes are an invaluable tool for developers and product owners. Understanding these codes is further essential to ensure user experience. We hope this article helped you to get the ground base on HTTP codes. You can now pay attention to them; they are crucial when developing or maintaining products!

Our human-centered approach and hard-earned reputation make us able to deliver successful, top-notch, and stunning products. Whether you're looking to move from an idea into a business or thinking of new iterations for your product, our UX-focused Custom Software Development company is here to help. Feel free to reach out, and let's shape the future together!
Contact us!