HTTP Status Codes

·

2 min read

HTTP Status Codes

google-404-error-page-1.png

Have you ever come across “Error 404: Page Not Found.” and wondered what this 404 is? So this is an HTTP Response Status Code.

What is an HTTP Response Status Code?

HTTP Response Status Code is response status sent by the server in reply to the request sent by a web browser.

Why do we use HTTP Status Code?

HTTP Status Code lets us know whether a specific request has been successfully completed or not.

HTTP Status Codes are categorized into five types:

  1. Informational Responses(100-199)
  2. Successful Responses (200–299)
  3. Redirects (300–399)
  4. Client Errors (400–499)
  5. Server Errors (500–599)

Let us look at the most common HTTP Status Codes that we encounter.

2XX(Success)

200 (OK): The request was fulfilled.

201 (Created): The request has succeeded and a new resource has been created.

204 (No Response): Server has received the request but has no information to send back.

4XX, 5XX(Errors)

4XX are generally where clients err.

400 (Bad Request): The server couldn't understand the request due to invalid syntax.

403 (Forbidden): The request is for something forbidden i.e the client does not have access to that content.

404 (Not Found):(The most common one) The server has not found anything matching the URI given.

5XX are generally where the server knows that the server has erred.

500 (Internal Server Error): This means that the server encountered a situation and the server doesn't know how to handle it.

502 (Bad Gateway): This means that the server got an invalid response while working as a gateway.

503 (Service Unavailable): This means that the server cannot handle any requests at the moment. The reason for this can be the maintenance of the server or the server is down.

504 (Timeout): This means that the server has not received any response int time while acting as a gateway.