Http status codes
HTTP status codes are three-digit numbers returned by a server to a client to indicate the status of a requested resource. They are an important part of the HTTP protocol and play a crucial role in web communication. In this post, we'll take a closer look at some of the most common HTTP status codes and what they mean.
The first digit of a status code indicates the general category of the response. The most common categories are:
-
1xx (Informational): The request was received, and the server is continuing to process it.
-
2xx (Successful): The request was successfully received, understood, and accepted.
-
3xx (Redirection): The request needs further action before it can be completed.
-
4xx (Client Error): The request contains bad syntax or cannot be fulfilled by the server.
-
5xx (Server Error): The server failed to fulfill a valid request.
Some of the most common status codes you're likely to encounter include:
-
200 OK: This is the most common status code and is returned when a request is successful and the requested information is returned.
-
201 Created: This status code is returned when a new resource has been successfully created in response to a POST request.
-
204 No Content: This status code is returned when a request is successful, but there is no additional information to send back, such as after a DELETE request.
-
400 Bad Request: This status code is returned when the server is unable to understand the request due to bad syntax.
-
401 Unauthorized: This status code is returned when the client is not authorized to access the requested resource.
-
403 Forbidden: This status code is similar to 401 Unauthorized, but indicates that the client is not forbidden to access the resource.
-
404 Not Found: This status code is returned when the requested resource cannot be found on the server.
-
500 Internal Server Error: This status code is returned when an unexpected condition was encountered by the server and no more specific message is suitable.
-
503 Service Unavailable: This status code is returned when the server is unable to handle the request due to maintenance or overloading.
In summary, HTTP status codes are an important part of the HTTP protocol and provide important information about the status of a requested resource. Understanding the different types of status codes and what they indicate can help you better understand and troubleshoot web communication.
Available HTTP status codes
Code | Name |
---|---|
1xx | Information responses |
100 | Continue |
101 | Switching Protocols |
102 | Switching Protocols |
103 | Early Hints |
2xx | Successful responses |
200 | OK |
201 | Created |
202 | Accepted |
203 | Non-Authoritative Information |
204 | No Content |
205 | Reset Content |
206 | Partial Content |
207 | Multi-Status |
208 | Already Reported |
226 | IM Used |
3xx | Redirection messages |
300 | Multiple Choices |
301 | Moved Permanently |
302 | Found |
303 | See Other |
304 | Not Modified |
305 | Use Proxy Deprecated |
307 | Temporary Redirect |
308 | Permanent Redirect |
4xx | Client error |
400 | Bad Request |
401 | Unauthorized |
402 | Payment Required Experimental |
403 | Forbidden |
404 | Not Found |
405 | Method Not Allowed |
406 | Not Acceptable |
407 | Proxy Authentication Required |
408 | Request Timeout |
409 | Conflict |
410 | Gone |
411 | Length Required |
412 | Precondition Failed |
413 | Payload Too Large |
414 | URI Too Long |
415 | Unsupported Media Type |
416 | Range Not Satisfiable |
417 | Expectation Failed |
418 | I'm a teapot |
421 | Misdirected Request |
422 | Unprocessable Entity |
423 | Locked |
424 | Failed Dependency |
425 | Too Early Experimental |
426 | Upgrade Required |
428 | Precondition Required |
429 | Too Many Requests |
431 | Request Header Fields Too Large |
451 | Unavailable For Legal Reasons |
5xx | Server error |
500 | Internal Server Error |
501 | Not Implemented |
502 | Bad Gateway |
503 | Service Unavailable |
504 | Gateway Timeout |
505 | HTTP Version Not Supported |
506 | Variant Also Negotiates |
507 | Insufficient Storage |
508 | Loop Detected |
510 | Not Extended |
511 | Network Authentication Required |