We all surf the internet and thus we all must be familiar with the words Client and Server . At the base level, the client(our browser) queries the DNS server, then the request goes to our gateway and finally after getting the final destination address, the client is all set to query the destination IP address and process the further information. Till now, it’s very simple. But sometimes in our browser we have seen that an error code is returned instead of a web page, but have we ever wondered why an error is returned instead of a web page? The concept here is that when our request reaches the end server, the server responds with HTTP status code, no matter either your request has been processed or not. Based on the replied status code, the response is decided. The server has five classes of codes to reply when it receives a request:
- 1xx
- 2xx
- 3xx
- 4xx
- 5xx
1xx
This class of status code states that the server has received our request and it’s further processing it and it will communicate to the end user about the actions taken by the server before executing the final action. We don’t need to worry about this status code as it is not an error code but rather just a informative status code.
2xx
This class of status code states that server has successfully received our request, understood it and it is taking the required action to execute our request. This class of status code is a mark of success and there are chances that server will reply with the web page we requested.
3xx
This class of status code states that server needs our further permission to execute a particular request. These errors are caused when there is a Redirection permission needed at our end. For example, consider a website which has changed its domain name, but the media still remembers it’s old domain name. So webmaster will enable some setting which asks the end user to redirect to a new URL.
4xx
This class of status code represents the error which has been generated due to some unexpected response from the client. In this condition ,the server returns the error 4xx. We will discuss some popular error codes which are recorded widely across the internet. These are:
400- This error generates when the server receives some malicious requests from the client browser. Malicious request can be an invalid cookie we might have edited, or some malicious packets that server has received from our end. Trying with another browser or refreshing the page can help one resolve this issue.
401- This error generates when the server is not able to verify us and hence declare us as an unauthorized entity to access a particular resource. For example when we enter our credentials in website of Netflix, the server queries the database and tries to find out that if this username is registered or not. If not ,the server replies with this error code and since the website has a web page designed for this error code, it asks us to enter the correct credentials again.
403- This error code generates when the client is trying to access that area of the server which has not been allowed to him . Like there are situation when webmaster blocks the access of user from some countries and when the server noticed that incoming IP address is from a blocked country, it will show the forbidden error.
404- This error is the most popular error code among all the users across the internet. Many people believe that removing this error is a time consuming task, but sometimes the actual cause of this error is nothing more than that a spelling mistake like if sometimes we put INDEX.php instead of index.php that actually exists on the server, the server will show 404 error. This is because the ASCII code of small alphabets is different from that of capital alphabets and thus the server interprets this as a different domain which does not exist on the server.
407- This error arises when the proxy server ,which lies in between the client and server is unable to authenticate the end user. In this case ,the end server just dumps the incoming request and throws the Proxy Authentication Required error. Big firms like Google uses Reverse Proxy servers which means that our request will first go to a proxy server set by Google and after getting authenticated it moves to the main end server. If our identity is not verified by the proxy, the server will show a webpage which has been set by web admin in server settings. This error is very similar to 401 error code and thus to mitigate this error, we should try again with valid credentials.
408- This error arises when a client is not able to send the required packets to the server in a given period of time and hence when the time exceed beyond the limit, the server throws the timeout error. There are couple of reasons that can cause this error:
- Internet connection is very slow.
- If we are using proxy, we may be behind a proxy that provides bad service.
5xx
This class of status code states that there is an internal error in the server itself due to which it is not able to serve it’s clients. This HTTP status code has nothing to do with client and thus client cannot do anything to remove this error. Here we will look at some common error codes which are seen by the users worldwide:
500- This error code is the most common error code received from the server whenever there is an internal error in a server. From internal server error , we mean that there might be incorrect code running at the server due to which it is able to execute our request. Chances are also there that the server don’t have the required environment to execute a particular code.
502- This error code arises when a server is using an additional reverse proxy server and that reverse proxy server receive an unexpected response from the main server. The error generated due to this problem is known as Bad Gateway error as the reverse proxy server is acting as gate to the end server.
503- This error code arises when a server is not able to serve to the client due to overloaded traffic on the server which is consuming all it’s resources and the server has no more sources left to serve the next user. This is the most common error nowadays we get from the end server as low quality servers are not able to tolerate even a low amount of traffic.
504- This error code arises when a reverse proxy server which is intercepting all the request to and from the main server is not able to get the required packages from the end server in a given period of time. Just as in the case of 408 error code in which the client is not able to send the packets in a given period of time, this error has arisen because the server is not able to send the required packets to the proxy server.