Panel Discussion: API Security in DevSecOps. Watch the Recording

Panel Discussion: API Security in DevSecOps. Watch the Recording

Panel Discussion: API Security in DevSecOps. Watch the Recording

/

/

404 Status Code - Not Found

404 Status Code - Not Found

404 Status Code - Not Found
404 Status Code - Not Found
404 Status Code - Not Found

Luke Stephens

Luke Stephens

Luke Stephens

What is 404 HTTP Code?

The HTTP Status Code 404, commonly known as "Not Found", is a client error response code that indicates the server cannot find the requested resource. It signifies that the client can communicate with the server, but the server cannot locate what was requested. This error code is one of the most recognizable due to its frequent occurrence on the web.

Understanding 404 Not Found

  • Resource Unavailable: A 404 Not Found typically means that the resource the client requested is not available on the server, either because it doesn't exist or the URI is incorrect.

HTTP/1.1 404 Not Found
  • No Indication of State: The absence of the resource does not indicate whether it was temporarily or permanently missing, or if it was removed deliberately.

  • Descriptive Error Pages: Web servers often provide custom error pages to explain the 404 Not Found error, sometimes including links to the home page or search functions to assist the user.

Why 404 Not Found?

The 404 Not Found status code is a standardized way of informing the client that the requested resource is not available, without giving details as to why it's missing. This ambiguity can be helpful in not disclosing whether the resource has been moved or deleted for security reasons.

Characteristics of 404 Not Found

  • Client Action Required: The code indicates that the client may need to take additional action, such as checking the resource URI or navigating back to a safe point in the application.

  • Not a Reflection of Server Error: A 404 Not Found status does not necessarily mean there is an error with the server itself, simply that the specific page or resource is not found.

How does 404 HTTP Code Work?

  1. Client Sends a Request:

    The client requests a resource or web page that the server cannot find or doesn't exist.

GET /nonexistent-page HTTP/1.1
Host: www.example.com
  1. Server Responds:

    The server processes the request, determines that the resource is not available, and issues a 404 Not Found response.

HTTP/1.1 404 Not Found
Content-Type: text/html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>404 Not Found</title>
  </head>
  <body>
    <h1>Not Found</h1>
    <p>The requested URL /nonexistent-page was not found on this server.</p>
  </body>
</html>

Example of 404 Not Found

Requesting a Missing Image File:

GET /images/logo.png HTTP/1.1
Host: www.example.com

Response:

HTTP/1.1 404 Not Found
Content-Type: text/html

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>404 Image Not Found</title>
  </head>
  <body>
    <h1>Image Not Found</h1>
    <p>The requested image was not found on this server.</p>
  </body>
</html>

In this example, the client attempts to retrieve an image that does not exist on the server. The server responds with a 404 Not Found status and a custom HTML page informing the user of the missing image.

Conclusion

The 404 Not Found status code is essential in web communication, signaling to clients that a resource is unavailable without specifying the reason. Understanding and effectively handling 404 Not Found responses is a key skill for web developers and site administrators to improve user experience and website maintenance.

On this page

Title

Protect your APIs from attacks now

Protect your APIs from attacks now

Protect your APIs from attacks now

Explore more from Akto

Blog

Be updated about everything related to API Security, new API vulnerabilities, industry news and product updates.

Events

Browse and register for upcoming sessions or catch up on what you missed with exclusive recordings

CVE Database

Find out everything about latest API CVE in popular products

Test Library

Discover and find tests from Akto's 100+ API Security test library. Choose your template or add a new template to start your API Security testing.

Documentation

Check out Akto's product documentation for all information related to features and how to use them.