51 HTTP Status Codes you should know

HTTP Status codes
HTTP Status Codes

There is a good number of HTTP status codes and they are sometimes confusing. Lets get a good detail about them but before that…

What is HTTP?

HTTP (Hyper Text Transfer Protocol) facilitates for the communication over the World Wide Web (WWW)  between clients and servers. A client requests data and the server sends response to the client. HTTP provides a system of communication followed on the web through HTTP requests and HTTP responses. The client (most times a web browser like Chrome or Fire Fox) sends a request to the server. The server then processes the request and sends a response back to the client. There are over 51 three-digit status codes the server responds with when a request is made. We will cover them in this article. But before that let us see…

Types of Requests made by the client

  • GET requests for a particular resource from the server
  • POST adds content or data to a web resource
  • PUT directly changes an existing web resource in the server or creates a new one
  • HEAD requests a specific resource minus the body content (information about the request)
  • DELETE removes a resource from the server
  • OPTIONS shows the end user the HTTP methods to be used for a specific URI
  • TRACE shows the user any changes made to a web resource
  • CONNECT modifies the request connection to a transparent TCP/IP tunnel (a port that forwards communication to a specific destination)
  • PATCH changes some parts of the web resource

When you make one of these requests to the server, you will get one of the following status codes in your response.

HTTP Status Codes

Informational Responses (100-199)

These responses show that your request has been accepted and is being processed by the server

1. 100 Continue

Here the server is telling the client that everything is fine so far and it is OK to continue sending in more requests

2. 101 Switching Protocol

The client requests the server to change the protocol. This response indicates that the server has accepted to switch the protocol and is sent for the Upgrade HTTP header.

3. 103 Early Hints

The server hints to the client to already load the resources while it is preparing the data to be returned and the final header.

Successful Responses (2**, staring with number 2)

Successful status codes show that the request has been successful and well processed.

4. 200 Ok

This indicates that the HTTP request has been successful. It is the standard response for the requests, GET, POST, PUT, HEAD plus TRACE.

5. 201 Created

This status code is sent to the server to tell you that a new resource has been created. You will see this with POST and PUT requests which are adding content to a web resource.

6. 202 Accepted

This is mainly used async responses (those that allow other processes to go on while waiting for it). It shows the server that the request has been received and being worked upon.

7. 203 Non-Authoritative Information

This status code indicates that the request has been successful but the data has been modified.

8. 204 No Content

The server here is telling you that your request was successful but there is nothing to give you.

9. 205 Reset Content

The server indicates that the request is successful but the document view needs to be redone again, change the contents of the request.

10. 206 Partial Content

The server gives out this status code alongside with data that is not completely full.

Redirect Status Codes (3**)

The server often returns a 3-digit status code starting with 3 to indicate that something more has to be done by the client to fulfill the request.

11. 300 Multiple Choice

The server will return this code when it has multiple options and you have to choose one to fulfill your request.

12. 301 Moved Permanently

The server gives out this code to indicate that the resource you want has been relocated to another URL and also sends it to you.

13. 302 Found

This means that the resource you requested for is temporarily changed and unavailable. And thus the request can’t be fulfilled momentarily.

14. 303 See Other

The server returns this code telling the client to check for the resource from some other URL.

15. 304 Not Modified

This tells the client to use the cached resources since they are the same since the last time of checking them.

16. 307 Temporary Redirect

This code redirects the client temporarily to another URL for the response just made. Since the resources have been temporarily changed to another URL.

17. 308 Permanent Redirect

The server returns this status code telling the client that the resources just requested for has been permanently shifted to another URL and also redirecting to that URL.

Client Error Responses (4**)

The server will return a three-digit code starting with 4 if the request made by the client causes some problem.

18. 400 Bad Request

You will see this in the client if the URL entered is invalid or a syntax that is not correct.

19. 401 Unauthorized

This shows that the client is not allowed to make any request and should first approve themselves

20. 403 Forbidden

The client is authenticated but does not have permission to access the resources.

21. 404 Not Found

Here it means the requested URL is invalid

22. 405 Method Not Allowed

This indicates that the method used to make the request is correct but it is not the right one to get the wanted resource.

23. 406 Not Acceptable

This means the server did not find a matching response for the request made.

24. 407 Proxy Authentication Required

This tells the client to first be authenticated by the proxy.

25. 408 Request Timeout

This status codes tells the client that the server is stopping the connection.

26. 409 Conflict

The server will return this when there is a conflict in the current state of resources.

27. 410 Gone

This means the resources has been removed permanently from the server.

28. 411 Length Required

The server tells the client to first to determine a defined content length so as to retrieve the resource

29. 412 Precondition Failed

This indicates to the client that the precondition set has not been fulfilled by the server.

30. 413 Payload Too Large

This indicates that the request is too big that the server can’t handle it. And also the connection might be closed by the server.

31. 414 URI Too Large

This means that the URI provided is too large to be processed by the server.

32. 415 Unsupported Media Type

This means that the media type included in the request is not supported by the server. Like, the clients makes a request with .png image yet the server supports .jpeg.

33. 416 Range Not Satisfiable

This means the range of data request for is not available

34. 417 Expectation Failed

This indicates the server won’t be able to provide the data requested for.

35. 422 Unprocessable Entity

This code means the server understood the request but was not able to process it due to semantic errors contained within it.

36. 426 Upgrade Required

This tells the client that the server has refused to take in the request with the current protocol and should upgrade it.

37. 428 Precondition Required

This tells the client to include a condition(s) in the request so that it does not conflict.

38. 429 Too Many Requests

This code tells the client that it has sent too many requests to the server in a given time period.

39. 431 Request Header Fields Too Large

Here the server is indicating that the request header is too large to be handled. And it should be reduced to before sending in another request.

40. 451 Unavailable For Legal Reasons

As it suggests, the server here can’t process the request because of legal issues.

Server Error Responses (5**)

These status codes indicate that the request from the client is well and good but the server encountered some errors.

41. 500 Internal Server Error

Something unexpected might occur which the server can’t handle and prevents it from handling the request momentarily.

42. 501 Not Implemented

This shows that the request has not been handled. It maybe because the server does not support the functionality requested by the client.

43. 502 Bad Gateway

This means that the server received an invalid response from another server while acting as a gateway / middle man.

44. 503 Service Unavailable

This means that the server is down and can’t handle the request.

45. 504 Gateway Timeout

This code means the server cannot get the response from the origin while acting as a gateway / middle man.

46. 505  HTTP Version Not Supported

The server here is saying it does not support the HTTP version used by the client in the request.

47. 506 Variant Also Negotiates

This code indicates that the server has an internal configuration error.

48. 507 Insufficient Storage

This means the request could not be processed because the server cannot store the representation required to complete it.

49. 508 Loop Detected

The server detected an unending process while working on the request.

50. 510 Not Extended

This is shown when the server wants more extensions in the request to fulfill and process it.

51. 511 Network Authentication Required

Here the client needs to approve authentication so as to gain network access.

Leave a Reply

Your email address will not be published. Required fields are marked *