HTTP Status Codes

HTTP, a word you must have read many times. This is the word that represents every website and it does not matter what kind of website it is. From a small business level website to a multinational organizational website, they all have this word. However, what is the HTTP? Not many people are aware of it.

Many people are also do not know how it works. How website requests and sends work. They are not aware of the errors that are generated by this complex requesting and responding mechanism glitches and what they mean.

For norm, it is just annoying when such forms of errors confront them. However, when it comes to IT arena, it can be somewhat embarrassing. Many reasons can lead to such response and request errors, which may include data connection problems from the server side, from the client side, or maybe some glitch from the internet provider’s side.

This can be an easy to fix the problem for a professional IT team but it can be a headache for those who are just small business owners. This article has all the possible fixes through which you can deal with these errors without much of a problem. Moreover, we will also discuss:

Good HTTP status codes: HTTP codes that run in the background and you do not see them.
There are useful HTTP status codes as well, which help in the development and conducting changes.

HTTP Definition and Components

Before we dive into details and all the technicalities, we need to know about all the basic things that are related to HTTP. First of all, HTTP stands for “Hyper Text Transfer Protocol”.

Protocol, What Is It?

When you were in high school, the first thing that used to happen, was that you used to express your patriotism to your country. Then the teacher used to take attendance of your class to check who is present in the class and who is not, and then there were different teachers’ classes and periods. Similarly, a protocol is a set of rules and procedure that are needed to be followed to complete a certain kind of event or interaction.

There are two types of protocols:

  • The orderly Protocols: Which are needed to be followed in a specific order.
  • The unorderly ones: In which it is not required to have any order.

The computer communicates with the web server, which has the website uploaded, in accordance with sets of rules and these sets of rules are called HTTP.

What is Hypertext?

You must have heard the term HTML and Hyperlink if you have ever been a little curious about the development of websites and if you have even used MS Word, there are high chances that you are aware of the hyperlink.

When web pages were first introduced in the 80s, they were in a literal way i.e. documents. They were linked with each other with the texts carrying links, which are called hyperlinks (today we call them simply links) and those were Hypertext documents.

These documents contained those hyperlinks, which were clickable and contained information through connection with each other. At that time, this idea was revolutionary. The language that was used for transmitting these documents was called HTML, and the rules, which are followed by the HTML, are called HTTP.

HTTP Request

Whenever you perform any sort of action, such as clicking on some link, typing a web address, or visiting a page, the web browser sends a request for the detail to the website’s server. The address that has been acquired by the request that has been made by the browser is defined as the domain name and the DNS system. In short, the DNS system is a registry, which locates the location of a website by its URL.

There are two basic kinds of requests in websites:

  • GET- this entry will send the request to deliver the resources regarding the website.
  • POST- This will let the DNS have some form of data, that you will provide, which help DNS to provide us the desired result.

HTTP Response

Whenever you try to proceed to a website, there are multiple stages of a response. First, it has the HTTP Status, which is based on two parts. One is the number and the second is the text, mentioning the status. If succeed, it becomes “200: Success”. After that, it goes to the header and then it comes to the resource that you are looking for. Now this resource might be a whole page or any other data having a link.

What Are The Status Code Classes?

We defined the HTTP status recently and we know what it gives out when the page is loaded successfully. However, this is not all that it represents. You might have faced errors like 404, 501, 417 and many other types of errors. These all are status codes and they represent some sort of error. The status codes are mostly 3-digit numbers and they are always from 1 to 5.

There are 5 different classes of status code. Which also contains many “infamous” codes as well. Such as the 404: Not Found error.

  • 1xx – Informational: These are responses, which are prompted when the browser is in the process of receiving data from the server.
  • 2xx- Success: As represented by its name, when the process is successful, this status prompts, although it is never made visible.
  • 3xx- Redirection: These status codes represent redirection from one link to another.
  • 4xx- Client Error: These errors occur when there is some sort of problem from the client side (the user).
  • 5xx- Server Error: These errors occur when there is some sort of problem from the server side (the data center error or server error).

HTTP Status Code 1xx

These codes were introduced at the time when HTTP/1.1 were introduced in the web browsing industry. It means that browsers that were supporting and running the HTTP/1.0 could not run this, so the servers had been not “ending” at 1xx codes.

HTTP 100

This is a single line and very easy to comprehend. A typical request and response sequence includes a simple request by the client, the process of receiving the request and then responding to the request accordingly.

This code runs when the response that is to be received is being delivered in different parts. This happens mostly with highly populated websites, which are receiving a high traffic. In addition, the respond might be too big, this is also a reason why it might get slow or the responder might not be ready to receive the request at that moment.

At this moment, the client browser may represent the “Expect: 100-continue”.
If everything goes accordingly, the response will be 100: Continue. Else, it will show the error of 417: Expectation failed

HTTP 101 Switching Protocols

  • This represents the switching of the protocol (as obvious). Sometimes, a client browser may expect the server to switch from HTTP/1.1 to HTTP/2.0.
  • If this process takes place, the browser returns the “101: Switching Protocols”.

HTTP 102 Processing

  • This code is only presented in the WebDAV. This is an IETF (Internet Engineering Task Force), which is a kind of extension, which authorizes the manipulation of files and acts similar to FTP. But it is totally different than that.
  • The WebDAV gives this code when the client requests for a response and the browser is still busy in fetching the response, so that client does not think that he got a timeout.

HTTP Status Code 2xx

These are the codes, which are supposed to run when the request has been responded in a completely successful manner.

HTTP 200 OK

This a standard response to all the requests that are made. This means that the GET and POST have received proper responses and requests accordingly.

HTTP 201 Created

Some requests are created with the intention to create a new resource. When such codes are passed, 201 is presented.

HTTP 202 Accepted

The request was received and accepted but was not acted upon.

HTTP 203 Non-Authoritative Information

This response occurs when a request has been received and in response, the server provides a resource from another source, therefore, it might be unreliable.

HTTP 204 No Content

This happens when the request has been responded with a successful response but does not need any content. Mostly occurs when a DELETE request is prompted.

HTTP 205 Reset Content

Very similar to 204, however, the 205 code provides the default state of the document to the client.

HTTP 206 Partial Content

Occurs when a client requests for resource and the server returns partial content because the client requested for partial content as well.

HTTP 207 Multi-Status

WebDAV requests can have more than one requests, which are identified as sub-requests. The 207 status indicates that the response contains an XML with all the document details and the status of each response as well.

HTTP Status Code 3xx

These codes are presented when more actions are required from the client side.

HTTP 300

This is represented by the browser when the server provides multiple options for resources to choose from.

HTTP 301

This represents that the resource has changed the URL permanently.

HTTP 302

This is contra of the 301, as it represents temporary redirects.

HTTP 303

Similar to 302, it means that the resource of the provided content can be found by another URL while using the GET method.

HTTP 304

When a resource of a specific URL is not modified, the browsers save the data for fast delivery. If so happens, the HTTP 304 will be presented.

HTTP 305

It occurs when requested resource is only available through a specific proxy.

HTTP 308

The current requested URL should be sent to another URL, for present and future requests as well.

HTTP Status Code 4xx

The HTTP code 4xx has the longest code list and it is not possible to entirely cover all of these error codes, but we will cover some of most famous ones

HTTP 400 Bad Request

This is a response to report a problem which can include malformed syntax, formatting error or some other sort of coding error.

HTTP 401 Unauthorized

This is used when the resource is only available to specified users.

HTTP 403 Forbidden

Similar to 401, the user does not have the authority. Unlike 401, authentication will not make any difference.

HTTP 404 Not Found

The most common error. It is represented when the request is valid but cannot be proceeded because the resource was not found.

HTTP 408 Request Timeout

This error occurs when the server times out while the request was waiting to be conveyed.

HTTP 417 Expectation Failed

If the expected header is not same of the requested one and the server defined one, it will present the Expectation Failed error.

HTTP 423 Locked

If the requested resource is locked, 423 Locked will be presented.

HTTP 428 Precondition Required

This is used when server represents with one or several conditions to be followed before providing the content. This can include a version of the browsers, etc.

HTTP 451 Unavailable for Legal Reasons

This still in draft form. As stated by name, if a resource is facing some sort of legal issues, this code is used.

HTTP Status Code 5xx

HTTP 50 Internal Server Error

This a very basic and a common error that is faced by web servers. If a web configuration change is conducted, it is needed to be thoroughly checked to avoid this error.

HTTP 502 Bad Gateway

This error occurs when a server starts responding as a proxy or gateway and the response is invalid in nature.

HTTP 503 Service Unavailable

When servers are overloaded or down for maintenance, these errors show up.

HTTP 504 Gateway Timeout

Similar to 502, this error is returned when the server is acting as a proxy or a gateway and does not respond within the time allotted for it.

HTTP 520 Unknown Error

This error is not a part of the HTTP standard, but it is used by those organizations, which are providing the enormous size of server infrastructures. The 520 Unknown Error is used for general “catch-all” error for identifying all the problems.

Resources