What are HTTP Status Codes and why are they used? List of common HTTP status codes

If you are a frequent internet user then I bet that you somehow know about the most common HTTP status code that is the legendary 404 – Content not found or Resource not found Error. So, what are these numbers? These numbers are referred as HTTP Status Codes.

HTTP, What?

Most of the browsing of web pages is done using HTTP (Hyper Text Transfer Protocol) or HTTPS (Secured HTTP). This is a standard protocol for web browsers and works on port no. 80 by default. Every time you open a URL for example – http://justtechthings.com or ftp://someftpsite.in , you mention a protocol (http or ftp- File Transfer Protocol)

What is a status code?

Your web browser (Chrome, Firefox or Safari etc.) requests the website to show that web page and sends a GET request to that particular web site using a protocol (say HTTP/1.1), then as a reply to that request, the web server responds with a status code for requested web page.

Jump to: 200, 301, 302, 307, 403, 404, 408, 500 and 503

List of most commonly reported HTTP Status Codes:

200 – OK

Status code 200 implies that your HTTP request was successful. It is a standard response for all the successful HTTP(1.0 or 1.1) requests. In other words, If an expected webpage opens up, then the response is believed to be 200.

301 – Moved Permanently or Hard Redirect

301 is a response for a redirect to another page but also mentioning that all the future requests should be directed to a given URI(Uniform Resource Identifier)
301 is very common and is totally expected from all the URL forwarding short links like http://justtechthings.com/fW45v which redirects to http://www.justtechthings.com/http-status-codes-and-usage/ (this page)

302 – Temporarily Moved – Soft Redirect (Applies to HTTP 1.0 only)

A 302 Status means that a particular URI is moved temporarily but future requests should not to be directed to the new URI.

307 – Temporarily Moved – Soft Redirect (Applies to HTTP 1.1)

It is same as that of 302 and implies that the request should be repeated again with another URI; however, future requests should still use the original URI. Note that the request method (GET or POST) is not allowed to be changed when regenerating the request.

403 – Forbidden

Encountering a 403 is unusual and unexpected for a normal user from non-technical background. But as soon as the user gains knowledge about URLs and reverse engineering, it is very common to see such errors for them.
Forbidden – means that you are not authorized to access the content which you have requested.
Example scenario:
You are surfing the web to search a media player which can play 5k HD videos, you might certainly visit 5kplayer.com and then you will click “Free Download Button” which actually fetches the file from address http://www.5kplayer.com/download/5kplayer.dmg
However, if you try being notorious and Open the URL : http://www.5kplayer.com/download/
The error page is expected.

404 – Not Found – The Villain of HTTP Error Universe

This error is like a world known celebrity and does not requires any introduction. Whenever a resource, you are trying to request is not available on the server, the Server is likely to throw a 404 – Resource Not found error.
This error may also creep because of typing errors or inconsistent updates on any website. An error 404 indicates that the source you requested is not available now, but may be available again in the future.

Some websites report a “Not Found” error by returning a standard web page with a “200 OK” response code; this is known as a Soft 404. In such a case, partial content of the page is available but the request to access a certain element results into a 404 – Not found error.

For example –
Scenario 1 –

Inconsistent updation

Someone(A) working at this site posts an article with any image linked to it. But another member B deletes that image from the server but forgets to update that article, then that article will throw a Soft 404 error ( Because the textual content is available but the request to access the image results into a 404 – Not found error )

Scenario 2:

Typing error

If a hyperlink is written on a bulletin board say http://justtechthings.com/lBg1G and a student tries to copy it on his notebook. The English letters I (Capital i) and l (normal L) look the same in various fonts, so the student actually types http://justtechthings.com/IBg1G which results in a 404 error because it does not exist.

Sample 404 error page – http://www.google.com/3525

408 – Request Timeout

Users with slow internet connection are fond of this HTTP error. Slower IP resolution, poor server pings and old browsers tend to produce 408 error. As soon as you first ping the server with a request, it starts waiting for your future requests until the connection is established and closed thereafter. If the client (a user accessing ot browsing a website) did not produce a request within the time that the server(who is replying to client’s request and has the website stored at it) was prepared to wait. Each server has its pre-configured time for which it waits for any client connection and respond to the same request. The client may repeat the same request after some time.

500 – Internal Server Error

The Father of all script errors; The generic most error message for any unexpected condition at server.
There are multiple scripts running at every server, and If any one of them results in a fatal error, the server is no longer able to respond to client’s request properly. Hence, resulting in an error – 500.

503 – Service Unavailable

It is a temporary error and implies that server is overloaded and can not respond to your request now. Further requests may or may not be answered. This type of error can be frequently seen on websites which are accessed by millions of users at once like “flipkart.com” or the web sites which lack rock-strong hardware support.
503 error can also witnessed if any website is under maintenance and web masters do not want clients to interrupt the up-gradation process.

Folks, that ends up the list of the most frequent HTTP status and error codes. You can read more about creating and setting your own customized error pages by overriding the default error texts and messages.