Errors in the HTTP protocol are behavior of a web server when, for some reason, it cannot successfully send the requested document to the client. The server communicates the error code to the client in the HTTP header.

Each error issued by the web server has a code corresponding to the class of error that occurred. Error codes (such as 403 or 404) are standardized and described in detail in the Internet standard RFC2616 (Hypertext Transfer Protocol -- HTTP/1.1). You can refer to this document for a detailed description of a specific error as the original source.

An example of a web request made manually using the program telnet:

# telnet www.avahost.ru 80
Trying 217.16.20.20...
Connected to www.
avahost.ru.
HEAD / HTTP/1.1
Host: www.
avahost.ru

HTTP/1.1 200 OK
Date: Mon, 29 Mar 2004 08:24:07 GMT
Server: CoffeeMaker/1.12 (Unix) mod_ssl/2.8 OpenSSL/0.9

The server returned a successful error code of 200 (OK). This was an example of a correct request to a document existing on the server that completed successfully. If the requested document did not exist on the server, the server would behave differently and issue a 404 error (document not found):

# telnet www.avahost.ru 80
Trying 217.16.20.20...
Connected to www.
avahost.ru.
HEAD /abcdef HTTP/1.1
Host: www.
avahost.ru

HTTP/1.1 404 Not Found
Date: Mon, 29 Mar 2004 08:42:01 GMT
Server: CoffeeMaker/1.12 (Unix) mod_ssl/2.8 OpenSSL/0.9

Error codes can be positive and negative or successful and unsuccessful. There are four types of codes:

  • 2xx - request completed successfully - the server successfully sent the requested document to the client
  • 3xx - the request was successfully redirected - also a positive code. It indicates that the client's request has been redirected. Used when working with caching servers, as well as in the algorithm when the client browser checks the relevance of the document on the server (date of creation, size, etc.)
  • 4xx - error - the document was not sent to the client because a critical error occurred. For example, the requested document was not found on the server, access to the document is denied, and so on
  • 5xx - server error - a critical error on the server. For example, the user’s script could not be processed normally on the server
Je li Vam ovaj odgovor pomogao? 31 Korisnici koji smatraju članak korisnim (89 Glasovi)