We are all daily users of the internet, we use it for playing games, watching videos, and for social networking and lot more. We access all of these via web browsers like Mozilla, Chrome, Internet explorer etc, sometimes we get some messages in our web browser as a result of a request made by us to the server.
HTTP status codes : The standard responses received by a web browser from the web servers as a result of an HTTP request made by it are called HTTP status codes. These codes can help us to identify the problem when a requested webpage does not load properly from the user end.
It can be also referred to as HTTP status line which includes the HTTP status code and HTTP reason phrase.
Example : ' 500 internal server error ' has http status code <strong>500</strong> and reason phrase <strong>internal server error</strong>
The HTTP status codes can be broadly divided into two.
1. 4xx Client Error
When the request for a web page or other resource contains bad syntax or cannot be filled for some other reason that probably from the end of the client (web surfer) then client error codes are generated.
Some common client error HTTP status codes include 404(not found), 403 (forbidden), and 400 (bad request).
2. 5xx Server Error
When the request for a web page or other resource is understood by the website’s server but is not able to complete it for some reason then server error status codes are formed.
Some common server error HTTP status codes include the ever popular 500 (internal server error), along with 503 (service unavailable) and 502 (bad gateway).
NB : There are also 1xx, 2xx, and 3xx codes that are informational, confirm success, or dictate a redirection, respectively. These additional types of HTTP status codes aren’t errors so you shouldn’t be alerted about them in the browser.
Some common HTTP status codes that we receive are explained below.
Client Error 4xx
400 Bad request: It happens when the syntax of the request is not correct. Check and correct the given data and try again.
401 Unauthorized: It occurs when the authorization to access an information is failed. Recommended fix is to make sure that you are accessing the right resource and to check the username and password.
403 Forbidden: The browser displays this code when the user does not have [the permission to access a file. The resources must be restricted for that particular user, if it is necessary revoke the permissions that restrict user access to the specified file or resource.
404 Not Found: This is the most common message that we all get on the browser and this error is shown when the requested resource is not found at the time of request. The reasons can be incorrect URL, or when the requested information is not existing on the server.
Server Error 5xx
500 Internal server error: This error is shown when no specified error message is available. The error is due to faulty server side scripting or the wrong permissions/ownership set to the files. The solution is to correct the coding and to set the right permissions/ownership to the script files.
501 Not Implemented: The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.
503 service unavailable : It indicates that the requested service is currently unavailable.
The above are some information on the HTTP status codes, for more codes and info you can check the following link.