Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 20, 2021 03:56 pm GMT

Why the 404 error ?

Hello everyone, today we're going to look at HTTP errors, you know like when you get a page not found with the 404 error. In reality there are almost a hundred different error codes. Don't worry, it's difficult to know them all by heart, but there are techniques to find out roughly where the error comes from. You are ready, so let's go !

Why did you invent these numbers ?

But then why did we invent these error numbers? The answer is actually quite simple, when a user requests a web page through his browser, the browser will send a request to the server under the world famous HTTP protocol. The server will also respond in HTTP format, and if all goes well will send the requested resource (in our case the web page). But everything gets complicated when there is an error. Knowing that there is an error is good, but knowing where is even better. This is why error numbers were quickly assigned to each different type of error. This is much more practical and saves time for many developers. For example, errors starting with 5 are problems at the server level.

The five categories of error

To simplify the whole thing, and to put some order in all these errors, categories have been created. There are three different categories:
1 - Informations
2 - Success
3 - Redirects
4 - Web client errors
5 - Server errors

The five categories of error

So if an error number starts with 4, we know directly that the problem comes from the web client.

Why 404 error ?

But why 404 errors? If you have been following this, you will notice that the first number is a 4 and that the error comes directly from the web client and not from the server. Indeed, the 404 error means that the resource is not found, the server has searched for it on its side but has not found it, so the error comes from the web client which has not provided the right url.

404 error

Going further with error 418

The HTTP error 418 has nothing to do with the other errors. Indeed its meaning is "I'm a teapot". It is actually a joke since it first appeared in the famous RFC 2324 on April 1, 1998. The explanations given by the developers are: " There is coffee all over the world. Increasingly, in a world in which computing is ubiquitous, the computists want to make coffee. Coffee brewing is an art, but the distributed intelligence of the web- connected world transcends art. Thus, there is a strong, dark, rich requirement for a protocol designed expressly for the brewing of coffee. Coffee is brewed using coffee pots. Networked coffee pots require a control protocol if they are to be controlled".
In other words, the famous Hyper Text Coffee Pot Control Protocol, or HTCPCP, is intended to send an error back to all those who would like to control a coffee pot remotely, telling them that they have mistakenly addressed themselves to ... a teapot .
This April 1st "joke" had its heyday at the time and is still featured on a number of official links in which its error code has been preserved.
There are still people asking questions about this 418 error, even today!

Google teapot

Specific errors

For those who wish to find a specific error, you can refer to these different tables classified by categories.
Some codes are not yet in use, but are intended for future use. Other codes do not result in any specific display to the user, but are implied (e.g. codes 200 or 304, which are never seen by the client as they concern the majority of successful requests).

All major HTTP errors are represented in these different tables, of the different error types:

Codes beginning with 1 (Informations):

CodeMessageMeaning
100ContinueWaiting for the application to be processed.
101Switching ProtocolsAcceptance of the change of protocol.
102ProcessingProcessing in progress (prevents the customer from exceeding the waiting time limit).
103Early HintsWhile waiting for the final response, the server returns links that the client can start downloading.

Codes beginning with 2 (Success):

CodeMessageMeaning
200OKRequest successfully processed. The response will depend on the query method used.
201CreatedRequest successfully processed and document created.
202AcceptedRequest processed, but no guarantee of result.
203Non-Authoritative InformationInformation returned, but generated by an uncertified source.
204No ContentRequest successfully processed but no information to return.
205Reset ContentRequest successfully processed, current page can be deleted.
206Partial ContentOnly part of the resource has been transmitted.
207Multi-StatusMultiple answers.(WebDav)
208Already ReportedThe document was previously sent in this collection.(WebDav)
210Content DifferentThe copy of the resource on the client side differs from that on the server (content or properties).(WebDav)
226IM UsedThe server has completed the request for the resource, and the response is a representation of the result of one or more instance manipulations applied to the current instance.

Codes beginning with 3 (Redirects):

CodeMessageMeaning
300Multiple ChoicesThe requested URI refers to several resources.
301Moved PermanentlyPermanently moved document.
302FoundDocument moved temporarily.
303See OtherThe answer to this request lies elsewhere.
304Not ModifiedDocument not modified since the last request.
305Use Proxy (since HTTP/1.1)The request must be re-addressed to the proxy.
306Switch ProxyCode used by an older version of RFC 26167, now reserved. It meant "The following requests must use the specified proxy ".
307Temporary RedirectThe request must be temporarily redirected to the specified URI.
308Permanent RedirectThe request must be permanently redirected to the specified URI.
310Too many RedirectsThe request has to be redirected too many times, or falls victim to a redirection loop.

Codes beginning with 4 (Web client errors):

CodeMessageMeaning
400Bad RequestThe syntax of the query is wrong.
401UnauthorizedAuthentication is required to access the resource.
402Payment RequiredPayment required to access the resource.
403ForbiddenThe server has understood the request, but refuses to execute it. Unlike the 401 error, authenticating will not make any difference. On servers where authentication is required, this usually means that authentication has been accepted but the access rights do not allow the client to access the resource.
404Not FoundResource not found.
405Method Not AllowedUnauthorised query method.
406Not AcceptableThe requested resource is not available in a format that would respect the "Accept" headers of the request.
407Proxy Authentication RequiredAccess to the resource allowed by identification with the proxy.
408Request Time-outThe amount of time a request from the client has been waiting on the server side. According to the HTTP specification: "The client did not produce a request within the time the server was willing to wait. The client MAY repeat the request without modification at any later time ".
409ConflictThe request cannot be processed at this time.
410GoneThe resource is no longer available and no redirection address is known.
411Length RequiredThe length of the request was not specified.
412Precondition FailedPreconditions sent by the request not checked.
413Request Entity Too LargeTreatment abandoned due to too high a demand.
414Request-URI Too LongURI too long.
415Unsupported Media TypeUnsupported query format for a given method and resource.
416Requested range unsatisfiableIncorrect "range" query header fields.
417Expectation failedExpected and defined behaviour in the header of the unsatisfactory request.
418Im a teapot"I am a teapot": This code is defined in RFC 232410 dated 1 April 1998, Hyper Text Coffee Pot Control Protocol. It is a webmaster's joke, intended to send an error back to anyone who wants to remotely control a coffee pot, telling them that they have mistakenly addressed a teapot :)
421Bad mapping / Misdirected RequestThe request has been sent to a server that is not capable of producing a response (for example, because a connection has been reused).
422Unprocessable entityThe entity provided with the request is incomprehensible or incomplete.(WebDAV)
423LockedThe operation cannot take place because the resource is locked.(WebDAV)
424Method failureA method in the transaction has failed.(WebDAV)
425Too EarlyThe server cannot process the request as it may be replayed.
426Upgrade RequiredThe client should change the protocol, for example to TLS/1.0.
428Precondition RequiredThe request must be conditional.
429Too Many RequestsThe customer has made too many requests within a given time frame.
431Request Header Fields Too LargeThe HTTP headers sent exceed the maximum size allowed by the server.
449Retry WithCode defined by Microsoft. The request should be returned after performing an action.
450Blocked by Windows Parental ControlsCode set by Microsoft. This error occurs when Windows Parental Controls are enabled and block access to the page.
451Unavailable For Legal ReasonsThis error code indicates that the requested resource is inaccessible for legal reasons.
456Unrecoverable ErrorUnrecoverable error.(WebDAV)

Codes beginning with 5 (Server errors):

CodeMessageMeaning
500Internal Server ErrorInternal server error.
501Not ImplementedClaimed functionality not supported by the server.
502Bad Gateway ou Proxy ErrorBy acting as a proxy or gateway server, the server received an invalid response from the remote server.
503Service UnavailableService temporarily unavailable or under maintenance.
504Gateway Time-outTime taken to wait for a response from a server to an intermediate server.
505HTTP Version not supportedHTTP version not supported by the server.
506Variant Also NegotiatesNegotiation error.
507Insufficient storageInsufficient space to edit properties or build the collection.(WebDAV)
508Loop detectedLoop in a resource linkage.(WebDAV)
509Bandwidth Limit ExceededUsed by many servers to indicate a quota overrun.
510Not extendedThe request does not respect the extended HTTP resource access policy.
511Network authentication requiredThe client must authenticate to access the network. Used by captive portals to redirect clients to the authentication page.

I hope you have enjoyed this article. If you have any questions, feel free to ask me in the comments.


Original Link: https://dev.to/clementgaudiniere/why-404-error--1n89

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To