404 Not Found
404 Not Found means the server has no resource at the requested URL, or chooses not to say it has one. The request reached a server that understood it; the path is the problem.
The server has nothing at this URL, or will not admit that it does.
The most common error on the web. It does not say whether the absence is temporary or permanent; use 410 if you know a resource is gone for good. When a route you just deployed returns 404, check the URL path prefix, trailing slashes, case sensitivity and whether the proxy forwards that path to the right backend.
The resource used to exist here, has been removed on purpose, and will not come back.
Stronger than 404: it tells clients and search engines to drop the URL. Use it for deleted content or retired API versions. Responses are cacheable by default.
Explained
A 404 says nothing about permanence. If a page was removed on purpose and will not return, 410 Gone is a clearer signal; search engines tend to drop 410 URLs from their index sooner.
Servers also use 404 to hide resources from callers without access, so in an API a 404 can mean "forbidden" in disguise. Check permissions as well as the path.
For single-page apps, a hard reload of a client-side route such as /settings returns 404 unless the web server is told to serve index.html for unknown paths (in nginx, try_files $uri /index.html;). Do the opposite for real missing pages: a page that says "not found" but returns 200 is a soft 404, which search engines flag as an error.
How to debug it
- Compare the exact path the server received (in its access log) with the route you expect: watch trailing slashes, letter case and URL encoding.
- If the app sits behind a proxy under a prefix such as
/api, check whether the proxy strips or keeps that prefix. In nginx, a trailing slash onproxy_pass http://app/;replaces the matched location prefix. - Confirm the new code is actually deployed and the request reaches the instance you think it does.
- For a static file, check that it exists in the document root the server uses, not just in your build output.
- For an API, check whether the 404 is the framework's default route-not-found response or your code reporting a missing record; their bodies usually differ.
Gotchas
- A custom 404 page must still send status 404; many CMS themes serve it with 200.
- Redirecting every missing URL to the home page is treated by search engines as a soft 404.
- 404 responses are cacheable by default, so a CDN can keep serving a 404 for a while after you add the page.
Related explainers
- 401 Unauthorized vs 403 Forbidden401 means the server does not know who you are; 403 means it knows and still says no. How to tell them...
- 405 Method Not Allowed405 means the URL exists but rejects that HTTP method. Common causes: missing routes, trailing-slash...
- 301, 302, 303, 307 and 308 redirects comparedWhich redirect to use: permanent or temporary, and whether POST stays POST. A clear comparison of 301,...