Qaynaq LABS · TOOLS

HTTP · 4xx Client Error

404 Not Found

The requested resource does not exist on the server.

When you see this status

  • User requests a non-existent URL path
  • API endpoint is removed or renamed
  • Resource is deleted but links remain
  • Typo in the URL path or query parameters
  • Server misconfiguration routes requests incorrectly

Common causes

  • Missing or incorrect route configuration
  • Deleted or moved resources without redirects
  • Permission issues hiding resources
  • Dynamic content generation failure
  • Reverse proxy or CDN misconfiguration

How to debug it

  1. Verify the requested URL is correct
  2. Check server logs for the exact path requested
  3. Inspect route definitions for typos or omissions
  4. Test with a simple static file request
  5. Validate dynamic content generation logic
  6. Review reverse proxy/CDN cache settings

Return this code in your framework

Express (Node.js)
app.get('/missing', (req, res) => res.status(404).send('Not Found'));
FastAPI (Python)
from fastapi import HTTPException
@app.get('/missing')
async def missing():
    raise HTTPException(status_code=404, detail="Not Found")
NestJS
@Get('missing')
findOne() {
  throw new NotFoundException();
}
Go (net/http)
http.Error(w, "Not Found", http.StatusNotFound)

About HTTP 404

HTTP status code 404 Not Found is part of the 4xx Client Error family. The requested resource does not exist on the server. Understanding it is essential for backend engineers, API designers, and anyone debugging integrations between services.

The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance: what triggers them, how to debug them in production, and exactly how to return them from common frameworks. Each code page is hand-curated and verified.

Frequently asked

Should I return 404 for missing user profiles?

Yes, treat missing user profiles as non-existent resources. Return 404 to avoid revealing user existence.

How do search engines treat 404 vs 410?

404 tells search engines to retry later. 410 indicates permanent removal, prompting faster de-indexing.

Can I customize the 404 response body?

Yes, but include helpful links or search functionality. Avoid exposing internal details.

Why do APIs sometimes return 404 for auth failures?

Security best practice: don't distinguish between missing resources and auth failures to prevent enumeration attacks.