Tech

Explainer

Updated

What does the HTTP 404 status code mean?

Key facts

Under RFC 9110, a 404 does not say whether the missing resource is gone for good, and the 410 Gone code is preferred when the server knows the condition is likely to be permanent.

The HTTP 404 (Not Found) status code means that the origin server did not find a current representation for the target resource, or that it is not willing to disclose that one exists, according to RFC 9110, the IETF standard that defines HTTP semantics. In the words of Section 15.5.5 of RFC 9110, "The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists."

Where 404 fits among status codes

The Internet Assigned Numbers Authority (IANA) registry of HTTP status codes lists 404 as Not Found and points to RFC 9110, Section 15.5.5, as its definition. The same registry describes the 4xx range as client errors, with the note that "The request contains bad syntax or cannot be fulfilled". RFC 9110 says the 4xx class indicates that the client seems to have erred, and that these status codes apply to any request method.

CodeNameDefined in
403ForbiddenRFC 9110, Section 15.5.4
404Not FoundRFC 9110, Section 15.5.5
410GoneRFC 9110, Section 15.5.11

The names and sections in the table are as listed in the IANA registry.

RFC 9110 was published in June 2022 by the Internet Engineering Task Force on the Standards Track, carries the number STD 97, and obsoletes earlier specifications including RFC 7231, as its header shows.

Is a 404 permanent?

Not necessarily. RFC 9110 says a 404 status code does not indicate whether the lack of a representation is temporary or permanent.

When 410 Gone is used instead

RFC 9110 defines 410 (Gone) as meaning that access to the target resource is no longer available at the origin server and that this condition is likely to be permanent. The same section says that a server that does not know, or has no way to determine, whether the condition is permanent ought to use 404 instead. In the other direction, the 404 definition says 410 is preferred over 404 when the origin server knows, presumably through some configurable means, that the condition is likely to be permanent.

The 410 section adds that 410 is primarily intended to help with web maintenance by telling the recipient that the resource is intentionally unavailable and that the server owners want remote links to it removed.

How 404 differs from 403 Forbidden

A 403 (Forbidden) response means the server understood the request but refuses to fulfill it, while a 404 means the server did not find a current representation or will not disclose that one exists. The two can overlap: RFC 9110 says an origin server that wishes to hide the current existence of a forbidden target resource may respond with 404 instead of 403.

Can a 404 be cached?

Yes. RFC 9110 says a 404 response is heuristically cacheable, unless otherwise indicated by the method definition or explicit cache controls. Its overview of status codes explains that responses with heuristically cacheable codes can be reused by a cache with heuristic expiration and lists 404 and 410 among those codes.

What a server should send with a 404

For all 4xx codes, RFC 9110 says that, except when responding to a HEAD request, the server should send a representation containing an explanation of the error situation and whether it is a temporary or permanent condition. It also says user agents should display any included representation to the user.

Have another question?