HTTP 404 Not Found vs gRPC 5 NOT_FOUND
HTTP 404 and gRPC NOT_FOUND both indicate a missing resource, but they operate in fundamentally different communication models. HTTP 404 applies to URL-addressed resources in a request-response cycle, while gRPC NOT_FOUND applies to entities referenced within RPC method parameters.
Deskripsi
The server cannot find the requested resource. The URL may be wrong, the resource may have been deleted, or it may never have existed.
Ketika Anda Melihatnya
When a URL is mistyped, a page has been deleted, or an API endpoint doesn't exist.
Cara Memperbaiki
Verify the URL is correct. Check for typos, case sensitivity, and trailing slashes.
Deskripsi
Some requested entity was not found. For example, a file or directory that the RPC was supposed to operate on does not exist.
Ketika Anda Melihatnya
The resource referenced in the request doesn't exist — such as looking up a user by ID that has been deleted or never created.
Cara Memperbaiki
Verify the resource identifier is correct. Ensure the resource was created before accessing it, or handle the not-found case gracefully in your client.
Perbedaan Utama
HTTP 404 means the URL itself does not map to any resource — the path does not exist.
gRPC NOT_FOUND means the entity referenced in the RPC request (by ID, name, etc.) was not found.
HTTP 404 can be cached by browsers and CDNs; gRPC NOT_FOUND is not cached at the transport layer.
HTTP 404 is often used to hide resources from unauthorized users (instead of 403); gRPC uses PERMISSION_DENIED separately.
gRPC NOT_FOUND is returned as a trailer in the HTTP/2 stream, not as an HTTP-level status code.
Kapan Menggunakan Yang Mana
Use HTTP 404 when a URL path does not match any route or the addressed resource does not exist. Use gRPC NOT_FOUND when a lookup by ID, key, or name within an RPC method yields no result. In API gateways that translate between HTTP and gRPC, map gRPC NOT_FOUND to HTTP 404.