Labels

Saturday, March 31, 2018

HTTP Status Code

HTTP Status Code is returned when an HTTP request is made to the server. The server returns an HTP Status Code in the response to your request. There are five classes of HTTP Status Code as following.
  1. Informational – 1XX
  2. Success – 2XX
  3. Redirection – 3XX
  4. Client Error – 4XX
  5. Server Error – 5XX
Let’s take a look at below diagram, which gives an idea how a status code is returned from the web server.
http-status-return
So now you have an idea how the status code is generated and here are some of the popular HTTP status return code in Infographics.

Success Response

200 – OK: The standard HTTP response for successful HTTP requests. In another way, the web server will return 200 when requested content is served successfully.
202 – Accepted: The server has accepted your request and yet to process them.
206 – Partial Content: Only partial content is delivered due to the range header sent by a client like wget.

Redirection Response

301 – Moved permanently: Your requested page has been moved permanently to a new location. This instructs search engine bot to crawl new location.
302 – Moved temporarily: Your requested is served from a different location but that is temporary arrangement. This instructs search engine bot to crawl the original location.
305 – Use proxy: The requested resource is only available through a proxy. That means you must use a relevant proxy to get the requested page successfully.
304 – Not modified: Usually when cached page is served when a resource has not been modified.

Client Error

400 – Bad request: The server is confused what you have requested. Probably bad syntax or trying to include characters in URI which server doesn’t understand.
401 – Not authorised: The requested page is protected and requires authentication. You must login in order to get the requested page successfully.
403 – Forbidden: You have to try to access which you don’t have permission. This, not necessary resource is protected by the password; it could also be when files/folder permission doesn’t allow viewing the requested page.
404 – Not found: Probably the most famous one – your requested page is not found on the server. You are trying to access something, which doesn’t exist.
405 – Method not allowed: You are requesting a page with the wrong method. For example, you are doing GET on POST data. Or you are trying the method, which is disabled for example – TRACE, PUT, DELETE.
408 – Request timeout: The server timed out waiting for the request
411 – Length required: Your request doesn’t meet the length of its content, which is required by the requested resource.

Server Error

500 – Internal server error: A very generic error when server encountered an error due to various reasons. Logs must be examined to see why the server has responded internal error.
502 – Bad gateway: The server was acting as a gateway or proxy and received an invalid response from the upstream server like TomcatWebSphere.
503 – Service unavailable: The server can’t serve your request. This could be due to either server is too busy in other stuff or almost dead.
I hope now you have an idea about HTTP status return code. If you find this useful, help in sharing with your friends.

No comments:

Post a Comment