Наиболее используемые коды статусов HTTP
Обзор наиболее часто используемых кодов статусов HTTP (eng. HTTP Status Code)
2xx Success (успешно)
Сообщения данного класса информируют о том, что сервер успешно принял и обработал запрос.
Status code | Status message | Description |
---|---|---|
200 | OK | Сервер успешно обработал запрос. Как правило, это означает, что сервер предоставил запрашиваемую страницу. |
3xx Redirection (перенаправление)
Следующие действия необходимы для выполнения запроса. Часто эти коды статуса используются для переадресации.
Status code | Status message | Description |
---|---|---|
300 | Multiple Choices | The server has several actions available based on the request. The server may choose an action based on the requestor (user agent) or the server may present a list so the requestor can choose an action. |
301 | Moved Permanently | The requested page has been permanently moved to a new location. When the server returns this response, it automatically forwards the requestor to the new location. The response should also include this location. It tells the client to use the new URL the next time it wants to fetch the same resource. |
302 | Moved Temporarily | The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. |
304 | Not Modified | The requested page hasn’t been modified since the last request. When the server returns this response, it doesn’t return the contents of the page. |
307 | Temporary Redirect | The server is currently responding to the request with a page from a different location, but the requestor should continue to use the original location for future requests. There is very little difference between a 302 status code and a 307 status code. 307 was created as another, less ambiguous, version of the 302 status code. |
4xx Request error (ошибка клиента)
Данный класс кодов предназначен для указания ошибок со стороны клиента.
При использовании всех методов, кроме HEAD, сервер должен вернуть в теле сообщения гипертекстовое пояснение для пользователя.
Status code | Status message | Description |
---|---|---|
400 | Bad Request | The server didn’t understand the syntax of the request. |
401 | Unauthorized | The request requires authentication, before a resource can be accessed, the client must be authorized by the server. The server might return this response for a page behind a login. |
403 | Forbidden | The server is refusing the request. Unlike a 401 unauthorized response, authenticating will make no difference. |
404 | Not Found | The server can’t find the requested page. For instance, the server often returns this code if the request is for a page that doesn’t exist on the server. |
410 | Gone | The server returns this response when the requested resource has been permanently removed. It is similar to a 404 (Not found) code, but is sometimes used in the place of a 404 for resources that used to exist but no longer do. If the resource has permanently moved, you should use a 301 to specify the resource’s new location. |
5xx Server error (ошибка сервера)
Данный класс кодов указывает, что сервер имеет внутреннюю ошибку, когда пытается обработать запрос.
Эти ошибки, как правило, связаны с самим сервером, а не с запросом.
Status code | Status message | Description |
---|---|---|
500 | Internal Server Error | The server encountered something it didn’t expect and was unable to complete the request. |
503 | Service Unavailable | The server is currently unavailable (due to a server overload or because it’s down for maintenance). Generally, this is a temporary state. |