Do you know what HTTP Status Codes are? HTTP Status Codes are the part of HTTP response messages that demonstrates the acknowledgment of the client’s request and specifies the type of response the server is transmitting to the client. HTTP, an abbreviation of Hypertext Transfer Protocol, defines the methodology and rules relating to how request/response messages reciprocate between web servers (servers) and browsers (clients).
There are only five classes of HTTP Status codes, ranging from 1xx to 5xx. Out of which, you can just view 4xx and 5xx error codes, typically shown in a webpage. The server does not reveal other status codes to users.
Can you recall the most common http status code? You thought it correct. It is 404 Not Found. It merely means that the webpage that you are requesting is not available on the server.
HTTP Status codes are not the same as the System error codes. You can use certain browser add-ons to see the HTTP response headers including status codes.
To understand more about HTTP status codes, you first need to know how HTTP works in the first place.
How HTTP works?
The World Wide Web relies on the Hypertext Transfer Protocol (HTTP) to handle all the interactions between the browsers and the websites.
The full communication involves two parties, a client, and a server. Your browser works as a client on behalf of you. And the server is the one that hosts a website
HTTP follows a request/response methodology.
Suggested read – HTTP vs HTTPS
What happens when you click on a link, type a URL in the address bar or press the submit button of a form? For you the answer may be, a webpage appears on the screen with all the information you need.
But internally, what happens is the browser establishes a connection and sends an HTTP request to a server for that information.
After that, the server fetches that request and then sends back an HTTP Response, with that information.
Now, we will discuss in detail the HTTP Status codes and their classes.
What is an HTTP Status Code?
Sometimes, you may not be successful in reaching the website you are trying to enter. Instead, you see an error or status code.
HTTP status codes are standard response codes given by website servers. They help to identify the cause of the problem when a web page or other resource does not load correctly.
The first line of the response message is called the status line. It includes the protocol version, numeric HTTP status codes and the related HTTP reason phrase in text form.
For example, the HTTP status line 301: Moved Permanently is made up of the HTTP status code of 301 and the HTTP reason phrase of Moved Permanently.
Your browser gets the HTTP Status Codes in the HTTP header.
Every time, your browser asks for a web page or resource, the server returns the status codes, but you don’t see them most. Only when an error occurs, you will notice an HTTP status code showing in your browser.
What are the different classes of HTTP Status Codes?
The Status Code portion in an HTTP response message is a three digit figure where the first digit specifies the class of response. The last two numbers do not have any categorization role.
The values of the first digit range from 1 to 5. Section 10 of RFC 2616 defines and divides these codes into five classes.
Each class has a specific meaning.
The Informational response is a provisional response that server issues while it continues processing the request.
It is the response that a server sends when it receives the request that a browser initiates.
HTTP/1.1 was the first to use this response. That is why; a server cannot send a 1xx code to browsers implementing HTTP/1.0 as they cannot handle them.
100 Continue, 101 Switching Protocols, and 102 Processing, are the status codes that belong to this response class.
When a server successfully receives, interprets, and accepts the browser request, it returns success codes.
200 OK, 204 No Content are some of the popular HTTP Status Codes belonging to this class.
The Redirection response states that the client has to perform an additional action to complete the request. It indicates redirection messages to the client.
When the resource or URL that the client wants has got a new resource / URL as a substitute, the server sends the redirection codes.
300 Multiple Choices, 301 Moved Permanently, 302 Found, 305 Use Proxy are some of the redirection codes.
4xx: Client Error
The Client error response indicates that the error seems to be from the client side, i.e., there is something wrong with the request.
In this case, along with the error status and the header information, the server also includes an entity with an explanation of the error. This entity also specifies whether the condition is temporary or permanent.
Some universal client error HTTP status codes include 404 Not Found, 403 Forbidden, and 400 Bad Request.
5xx: Server Error
The Server Error indicates that the problem is on the server side.
When a website’s server accepts the request but is incapable of processing it due to some reasons, it returns server error codes to the client.
It specifies the server was unsuccessful in fulfilling a valid request.
Some universal server error HTTP status codes include 500 Internal Server Error, 503 Service Unavailable and 502 Bad Gateway.
What are the common HTTP Status Codes?
There are almost 50-60 HTTP Status Codes. However, there are just a few of them that you will catch a glimpse of into on a regular basis.
Now, we will discuss some of the most common HTTP Status Codes.
The 100 Continue status code allows an HTTP client to send a small message asking the server to respond with a continue code. It then waits for the response before initiating further follow-up request.
This response indicates that everything is going well and the client can continue with the request or ignore it if it is already complete.
HTTP 200 OK is the standard response for HTTP successful requests. It occurs when the web server processes the request successfully and transmits the content to the browser.
Almost all HTTP requests result in this status.
204 No Content
When the server successfully processes the request but does not need to return any content, 204 No Content code is sent.
Most often, this happens due to a DELETE request by the client.
When a server sends the 204 code, the browser does not change its view.
301 Moved Permanently
When the client requests an URL that is now present on some other site, the server returns the HTTP 301 Moved Permanently code.
It allows the client to issue a new request and get the resource from the new site. Web browsers automatically follow HTTP 301 redirects without requiring user intervention.
When you redesign your or make changes in the URL, it is essential to have a 301 redirect for the URL from the original site.
Failure to do so will cause broken links and unhappy visitors.
400 Bad Request
A response of 400 Bad Request usually means the web server did not understand the request.
The cause can be malformed syntax, or invalid formatting, etc. Due to this denial of request happens.
Typically, this indicates a technical glitch involving the client, but data corruption on the network itself can also cause the error.
The 401 Unauthorized errors eventuate when an unauthenticated client wants access to a secure page or resource with invalid credentials.
To fix this error, a client must log in to the server with a valid username and password. Make sure you do not enter an incorrect username and password.
403 Forbidden is a bit similar to 401 code. It means that the request is valid, but the server is not responding to it because the client has no permission to access the resource.
The client is not allowed to see a particular file. If a server does not want more visitors, then also it returns this error code.
It is a permission issue.
404 Not Found
404 Not Found is the most commonly seen 4xx class error, and also the most noticeable HTTP status for a casual website user. It merely means that the resource that the client is requesting for is not available on the server.
This error most commonly occurs when you manually enter an incorrect URL into a browser. It also arises when the website administrator removes the resource/URL without redirecting the address to a valid new location.
Users should recheck the URL to fix this problem or wait for the web administrator to correct it.
500 Internal Server Error
500 status code is the most generic status for unexpected errors. Web servers issue 500 Internal server Error when something indeterminate went wrong.
They occur when the server encounters some general technical glitch such as being low on available memory or disk space.
502 Bad Gateway
502 Bad Gateway errors appear during a network issue between the client and server.
The main triggers of this error are configuration errors on a network firewall, router, or other network gateway device. It merely means that the server got an invalid response from the upstream server.
503 Service Unavailable
HTTP 503 Service Unavailable means that a web server cannot process the incoming client request and the server is currently unavailable. For example, when the server is down for maintenance or over-allocated.
A 503 error implies that the outage is temporary.
It generally appears on highly busy servers, and it announces that the server was ineffectual to wrap up the request due to a server overload.
Are HTTP error codes and system error codes related?
An HTTP status code has no relation with a Device Manager Error code or a system error code.
Several system error codes share code numbers with HTTP status codes. But they are different errors and have entirely different error messages and meanings.
For instance, the HTTP status code 403.2 means Read access forbidden. However, there’s also a system error code 403 that means the process is not in background processing mode.
Similarly, the 500 Internet Server Error could code, and a 500 system error code 500 that means the system cannot load the User profile, is not the same.
The HTTP error codes display in a web browser and explain an error message about the client or server. On the other hand, a system error code shows up in Windows and doesn’t involve the web browser at all.
Look carefully at where you see the message to identify the difference between them.
If you see an error in your web browser, on the web page, it’s an HTTP response code. Similarly, you will find the Device Manager Error codes in the Device Manager.
How can you see HTTP Status Codes?
Now that you have read so many things about these status codes, you must be excited to see all of them in actual. Aren’t you?
Your browser does not usually show most of them, except the error codes. However, there are various tools available that make it easy for you to view them.
Some developer-friendly browsers, like Chrome and Firefox, have browser extensions. For example, HttpFox for Firefox is pretty good HTTP analyzer. It will show you the headers in real time.
Also, there are many web-based header fetching tools like Web Sniffer.
To summarize, HTTP Status Codes are not a part of the web page. Instead, it is a response message from the server informing you about how things went when the server accepted the request to view the page.
These messages flow every time your browser interacts with the server, even if you don’t see them all that often.
HTTP status codes are extensible, and HTTP applications do not have to understand the meaning of all the existing status codes.
But if you’re a website owner or developer, then having an idea about HTTP status codes is crucial. HTTP status codes are an indispensable tool for diagnosing and fixing website configuration errors.