Response codes
The first line of the HTTP response is the state drain. It consists of two parts: a three-digit number (response code) and a text message (response description).
RESPONSE-CODE TEXT-DESCRIPTION
The client learns the status of its request from the response code and decides what to do next. Examples of different responses from the server:
201 Created |
---|
401 Unauthorized |
507 Insufficient Storage |
Response codes are divided into 5 categories. The first digit of the response code determines which category it belongs to.
All answers starting with the number 1 are classified as informational. We will not talk about them in detail ...
Response code 200
After all, there are others that are much more interesting to us. All responses that look like 2xx are successful. The response most loved by programmers is 200 OK , which means that everything is fine, the request was successfully completed.
You may also find this list of other “good” answers helpful:
Code | Line | Description |
---|---|---|
200 | OK | Fine |
201 | Created | Created |
202 | accepted | Accepted |
203 | Non-Authoritative Information | Information is not authoritative |
204 | no content | No content |
205 | Reset content | Reset content |
208 | already reported | Already reported |
Response codes 301, 302
Responses that look like 3xx are in the redirect class . They indicate that the resource has been moved to another location.
The most popular of them:
- 301 - moved permanently
- 302 - moved temporarily
In the colloquial speech of programmers, you will often hear “302 redirect” or “301 redirect” - this is just about it.
Full list of 300 replies:
Code | Line | Description |
---|---|---|
300 | Multiple Choices | many options to choose from |
301 | Moved Permanently | moved forever |
302 | Moved Temporarily | moved temporarily |
303 | See other | watch other |
304 | Not Modified | did not change |
305 | use proxy | use proxy |
307 | Temporary Redirect | temporary redirect |
308 | Permanent Redirect | permanent redirect |
Response code 404
All answers that start with the number 4 indicate a client-side error , and there are a lot of them. The most popular you know for sure: this is the answer “404 - not found”.
Other common answers are given in the table:
Code | Line | Description |
---|---|---|
400 | Bad Request | invalid request |
401 | Unauthorized | not authorized |
402 | Payment Required | payment required |
403 | Forbidden | forbidden |
404 | not found | not found |
405 | Method Not Allowed | method not supported |
406 | Not Acceptable | unacceptable |
407 | Proxy Authentication Required | proxy authentication required |
408 | Request Timeout | timed out |
413 | Payload Too Large | payload too large |
414 | URI Too Long | URI is too long |
429 | Too Many Requests | too many requests |
499 | Client Closed Request | the client closed the connection |
Response code 501
And finally, the last category is server-side errors. All such errors start with the number 5. The most common error for a developer is 501 (functionality not implemented). Sometimes it happens.
In general, get acquainted with these error codes, they are now your friends for the rest of your life. Well, as usual, here is a table with the most useful error codes on the server side:
Code | Line | Description |
---|---|---|
500 | Internal Server Error | Internal Server Error |
501 | Not Implemented | not implemented |
502 | Bad Gateway | wrong gateway |
503 | Service Unavailable | service is unavailable |
504 | Gateway Timeout | gateway not responding |
507 | Insufficient Storage | storage overflow |
508 | Loop Detected | endless redirect |
509 | Bandwidth Limit Exceeded | channel bandwidth exhausted |
520 | unknown error | Unknown error |
521 | Web Server Is Down | web server not working |
522 | Connection Time Out | connection not responding |
523 | Origin Is Unreachable | source unavailable |
524 | A Timeout Occurred | timeout expired |
525 | SSL Handshake Failed | SSL handshake failed |
526 | Invalid SSL Certificate | invalid SSL certificate |